Skip to content

Commit 67f122b

Browse files
committed
Fix scroll events for Firefox
1 parent 77a061f commit 67f122b

4 files changed

Lines changed: 62 additions & 55 deletions

File tree

d3.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1450,9 +1450,8 @@ function d3_selection(groups) {
14501450

14511451
// TODO namespaced event listeners to allow multiples
14521452
groups.on = function(type, listener) {
1453-
type = "on" + type;
14541453
return groups.each(function(d, i) {
1455-
this[type] = function(e) {
1454+
var l = function(e) {
14561455
var o = d3.event; // Events can be reentrant (e.g., focus).
14571456
d3.event = e;
14581457
try {
@@ -1461,6 +1460,10 @@ function d3_selection(groups) {
14611460
d3.event = o;
14621461
}
14631462
};
1463+
if (this.addEventListener)
1464+
this.addEventListener(type, l, false);
1465+
else
1466+
this["on" + type] = l;
14641467
});
14651468
};
14661469

0 commit comments

Comments
 (0)