Optimise selection.order.
A small optimisation: only call insertBefore() if node.nextSibling isn't already what we want, so that document nodes that are already in the correct order can be skipped.
This commit is contained in:
Родитель
a92f8b3ed0
Коммит
b9a03ad84a
|
@ -1777,7 +1777,7 @@ d3_selectionPrototype.order = function() {
|
||||||
for (var j = -1, m = this.length; ++j < m;) {
|
for (var j = -1, m = this.length; ++j < m;) {
|
||||||
for (var group = this[j], i = group.length - 1, next = group[i], node; --i >= 0;) {
|
for (var group = this[j], i = group.length - 1, next = group[i], node; --i >= 0;) {
|
||||||
if (node = group[i]) {
|
if (node = group[i]) {
|
||||||
if (next) next.parentNode.insertBefore(node, next);
|
if (next && next !== node.nextSibling) next.parentNode.insertBefore(node, next);
|
||||||
next = node;
|
next = node;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -2,7 +2,7 @@ d3_selectionPrototype.order = function() {
|
||||||
for (var j = -1, m = this.length; ++j < m;) {
|
for (var j = -1, m = this.length; ++j < m;) {
|
||||||
for (var group = this[j], i = group.length - 1, next = group[i], node; --i >= 0;) {
|
for (var group = this[j], i = group.length - 1, next = group[i], node; --i >= 0;) {
|
||||||
if (node = group[i]) {
|
if (node = group[i]) {
|
||||||
if (next) next.parentNode.insertBefore(node, next);
|
if (next && next !== node.nextSibling) next.parentNode.insertBefore(node, next);
|
||||||
next = node;
|
next = node;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче