Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix d3.selectAll(HTMLCollection) #2376

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion d3.js
Expand Up @@ -1054,7 +1054,7 @@
group = d3_array(d3_selectAll(nodes, d3_document));
group.parentNode = d3_document.documentElement;
} else {
group = nodes;
group = d3_array(nodes);
group.parentNode = null;
}
return d3_selection([ group ]);
Expand Down
2 changes: 1 addition & 1 deletion d3.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/selection/selection.js
Expand Up @@ -74,7 +74,7 @@ d3.selectAll = function(nodes) {
group = d3_array(d3_selectAll(nodes, d3_document));
group.parentNode = d3_document.documentElement;
} else {
group = nodes;
group = d3_array(nodes);
group.parentNode = null;
}
return d3_selection([group]);
Expand Down
4 changes: 4 additions & 0 deletions test/selection/selectAll-test.js
Expand Up @@ -39,6 +39,10 @@ suite.addBatch({
"groups are arrays, not NodeLists": function(d3) {
var div = d3.select("body").selectAll(function() { return this.getElementsByClassName("div"); });
assert.isTrue(Array.isArray(div[0]));

var body = d3.select("body").node(),
sel = d3.selectAll(body.children);
assert.isTrue(Array.isArray(sel[0]));
},
"sets the parentNode to the document element": function(d3) {
var selection = d3.selectAll("body"),
Expand Down