Skip to content

Commit 7e5fc72

Browse files
Allow on to be used with event capturing.
1 parent 01124f2 commit 7e5fc72

3 files changed

Lines changed: 10 additions & 8 deletions

File tree

d3.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1513,7 +1513,8 @@ function d3_selection(groups) {
15131513

15141514
// type can be namespaced, e.g., "click.foo"
15151515
// listener can be null for removal
1516-
groups.on = function(type, listener) {
1516+
groups.on = function(type, listener, capture) {
1517+
if (arguments.length < 3) capture = false;
15171518

15181519
// parse the type specifier
15191520
var i = type.indexOf("."),
@@ -1522,8 +1523,8 @@ function d3_selection(groups) {
15221523

15231524
// remove the old event listener, and add the new event listener
15241525
return groups.each(function(d, i) {
1525-
if (this[name]) this.removeEventListener(typo, this[name], false);
1526-
if (listener) this.addEventListener(typo, this[name] = l, false);
1526+
if (this[name]) this.removeEventListener(typo, this[name], capture);
1527+
if (listener) this.addEventListener(typo, this[name] = l, capture);
15271528

15281529
// wrapped event listener that preserves d, i
15291530
function l(e) {

0 commit comments

Comments
 (0)