fix out-of-order issue when mixing new and old elements
This commit is contained in:
parent
08dd1cd62d
commit
b972607c8d
8 changed files with 64 additions and 22 deletions
|
|
@ -10,6 +10,12 @@ mock.window = new function() {
|
|||
appendChild: window.document.appendChild,
|
||||
removeChild: window.document.removeChild,
|
||||
replaceChild: window.document.replaceChild,
|
||||
insertBefore: function(node, reference) {
|
||||
node.parentNode = this
|
||||
var index = this.childNodes.indexOf(reference)
|
||||
if (index < 0) this.childNodes.push(node)
|
||||
else this.childNodes.splice(index, 0, node)
|
||||
},
|
||||
setAttribute: function(name, value) {
|
||||
this[name] = value.toString()
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue