From 5db2dc843465eb82ef7030c2a9d26d18ba294300 Mon Sep 17 00:00:00 2001 From: Leo Horie Date: Tue, 16 Sep 2014 00:29:01 -0400 Subject: [PATCH] clean up redundant code --- tests/mock.js | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/tests/mock.js b/tests/mock.js index 660f08f4..5629dbce 100644 --- a/tests/mock.js +++ b/tests/mock.js @@ -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