Skip to content

Commit

Permalink
fix: remove unnecessary call to removeChild
Browse files Browse the repository at this point in the history
  • Loading branch information
sbeleidy committed Mar 11, 2017
1 parent cbbf23c commit e18f4fb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "reverse-element",
"version": "0.0.4",
"version": "0.0.5",
"description": "Reverses child elements based on property - helpful for accessibility",
"main": "reverse-element.html",
"license": "MIT",
Expand Down
4 changes: 2 additions & 2 deletions reverse-element.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@
},
},
_reverse: function (newVal, oldVal) {
// reverse if we went from undefined to true or we changed values and the old value wasn't undefined.
if ((newVal != oldVal && oldVal != undefined) || (newVal && oldVal==undefined) ) {
// loop from the bottom and remove
for (var i = this.childNodes.length - 1; i >= 0; i--) {
x = this.removeChild(this.childNodes[i]);
this.appendChild(x);
this.appendChild(this.childNodes[i]);
}
}
}
Expand Down

0 comments on commit e18f4fb

Please sign in to comment.