clean up redundant code

This commit is contained in:
Leo Horie 2014-09-16 00:29:01 -04:00
parent b3b3853d71
commit 5db2dc8434

View file

@ -15,16 +15,10 @@ mock.window = new function() {
insertBefore: function(node, reference) {
node.parentNode = this
var referenceIndex = this.childNodes.indexOf(reference)
if (referenceIndex < 0) {
var index = this.childNodes.indexOf(node)
if (index > -1) this.childNodes.splice(index, 1)
this.childNodes.push(node)
}
else {
var index = this.childNodes.indexOf(node)
if (index > -1) this.childNodes.splice(index, 1)
this.childNodes.splice(referenceIndex, 0, node)
}
var index = this.childNodes.indexOf(node)
if (index > -1) this.childNodes.splice(index, 1)
if (referenceIndex < 0) this.childNodes.push(node)
else this.childNodes.splice(referenceIndex, 0, node)
},
insertAdjacentHTML: function(position, html) {
//todo: accept markup