Skip to content

Commit 2d83168

Browse files
committed
Merge remote-tracking branch 'origin/enter-size' into 3.4.12
2 parents b5ddd2b + a35000b commit 2d83168

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

d3.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -911,7 +911,7 @@
911911
};
912912
d3_selectionPrototype.size = function() {
913913
var n = 0;
914-
this.each(function() {
914+
d3_selection_each(this, function() {
915915
++n;
916916
});
917917
return n;

d3.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/selection/size.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import "selection";
1+
import "each";
22

33
d3_selectionPrototype.size = function() {
44
var n = 0;
5-
this.each(function() { ++n; });
5+
d3_selection_each(this, function() { ++n; });
66
return n;
77
};

test/selection/enter-test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ suite.addBatch({
1717
var selection = enter.foo();
1818
assert.equal(d3.select("body").html(), "<foo></foo><foo></foo>");
1919
delete d3.selection.enter.prototype.foo;
20+
},
21+
"size": function(d3) {
22+
var enter = d3.select("body").selectAll("div").data([0, 1]).enter();
23+
assert.equal(enter.size(), 2);
2024
}
2125
}
2226
});

0 commit comments

Comments
 (0)