Comparing version 0.0.5 to 0.0.6
{ | ||
"name": "vdom", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "A DOM create and patch algorithm for vtree", | ||
@@ -23,3 +23,3 @@ "keywords": [], | ||
"x-is-array": "0.1.0", | ||
"vtree": "0.0.4" | ||
"vtree": "0.0.5" | ||
}, | ||
@@ -26,0 +26,0 @@ "devDependencies": { |
@@ -121,2 +121,3 @@ var applyProperties = require("./apply-properties") | ||
var i | ||
var reverseIndex = bIndex.reverse | ||
@@ -127,10 +128,31 @@ for (i = 0; i < len; i++) { | ||
var insertOffset = 0 | ||
var move | ||
var node | ||
var insertNode | ||
for (i = 0; i < len; i++) { | ||
var move = bIndex[i] | ||
if (move !== undefined) { | ||
var node = children[move] | ||
domNode.removeChild(node) | ||
domNode.insertBefore(node, childNodes[i]) | ||
move = bIndex[i] | ||
if (move !== undefined && move !== i) { | ||
// the element currently at this index will be moved later so increase the insert offset | ||
if (reverseIndex[i] > i) { | ||
insertOffset++ | ||
} | ||
node = children[move] | ||
insertNode = childNodes[i + insertOffset] | ||
if (node !== insertNode) { | ||
domNode.insertBefore(node, insertNode) | ||
} | ||
// the moved element came from the front of the array so reduce the insert offset | ||
if (move < i) { | ||
insertOffset-- | ||
} | ||
} | ||
// element at this index is scheduled to be removed so increase insert offset | ||
if (i in bIndex.removes) { | ||
insertOffset++ | ||
} | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15367
351
+ Addedvtree@0.0.5(transitive)
- Removedvtree@0.0.4(transitive)
Updatedvtree@0.0.5