diff --git a/lib/widget.js b/lib/widget.js index 24eff63..86c43d7 100644 --- a/lib/widget.js +++ b/lib/widget.js @@ -2329,11 +2329,8 @@ Element.prototype.setIndex = function(index) { var i = this.parent.children.indexOf(this); if (!~i) return; - this.parent.children.splice(index, 0, this); - - if (index <= i) i++; - - this.parent.children.splice(i, 1); + var item = this.parent.children.splice(i, 1)[0] + this.parent.children.splice(index, 0, item); }; Element.prototype.setFront = function() {