Skip to content

Commit 940d38d

Browse files
committed
Fix d3#1407 - transition.filter crashes on empty.
Also remove unneeded third argument to d3_transition since transition.time is now stored on the per-node transition object.
1 parent 95bc9f4 commit 940d38d

4 files changed

Lines changed: 14 additions & 18 deletions

File tree

d3.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7513,7 +7513,7 @@ d3 = function() {
75137513
}
75147514
}
75157515
}
7516-
return d3_transition(subgroups, this.id, this.time).ease(this.ease());
7516+
return d3_transition(subgroups, this.id);
75177517
};
75187518
d3_transitionPrototype.tween = function(name, tween) {
75197519
var id = this.id;

d3.min.js

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/transition/filter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ d3_transitionPrototype.filter = function(filter) {
1818
}
1919
}
2020

21-
return d3_transition(subgroups, this.id, this.time).ease(this.ease());
21+
return d3_transition(subgroups, this.id);
2222
};

test/transition/transition-test-filter.js

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -66,19 +66,15 @@ module.exports = {
6666
"returns a new selection": function(span) {
6767
assert.isFalse(span.filter(function() { return 1; }) === span);
6868
},
69-
"inherits the delay": function(t1) {
70-
var t2 = t1.filter(function() { return 1; });
71-
assert.equal(t2[0][0].__transition__[t2.id].delay, 100); // TODO should inherit the whole transition object
72-
},
73-
"inherits the duration": function(t1) {
74-
var t2 = t1.filter(function() { return 1; });
75-
assert.equal(t2[0][0].__transition__[t2.id].duration, 150);
76-
},
77-
"inherits easing": function(t1) {
78-
// TODO how to test this?
69+
"works on empty selections": function(span) {
70+
var none = function() { return false; },
71+
empty = span.filter(none);
72+
assert.isTrue(empty.empty());
73+
assert.isTrue(empty.filter(none).empty());
7974
},
80-
"inherits the transition id": function(t1) {
75+
"inherits the transition id and, by extension, all transition parameters": function(t1) {
8176
var t2 = t1.filter(function() { return 1; });
8277
assert.equal(t2.id, t1.id);
78+
assert.strictEqual(t2[0][0].__transition__[t2.id], t1[0][0].__transition__[t1.id]);
8379
}
8480
};

0 commit comments

Comments
 (0)