-
Notifications
You must be signed in to change notification settings - Fork 22.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
By default, enter-insert before updating sibling.
Fixes #744. This implements a default `before` selector such that when entering elements are inserted (e.g., enter.insert("div")), they are inserted before the next following sibling in the update selection, if any. This change does not affect the behavior of append, so as to preserve backwards-compatibility, and likewise does not affect the behavior of insert on non-enter selections.
- Loading branch information
Showing
10 changed files
with
52 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import "selection"; | ||
import "enter"; | ||
|
||
d3_selection_enterPrototype.insert = function(name, before) { | ||
if (arguments.length < 2) before = d3_selection_enterInsertBefore(this); | ||
return d3_selectionPrototype.insert.call(this, name, before); | ||
}; | ||
|
||
function d3_selection_enterInsertBefore(enter) { | ||
return function(d, i, j) { | ||
var group = enter[j].update, | ||
n = group.length, | ||
node; | ||
while (++i < n && !(node = group[i])); | ||
return node; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters