From: Michael M Slusarz Date: Thu, 18 Mar 2010 22:51:57 +0000 (-0600) Subject: Optimize row removal X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=de792d5ed2c5075b2cde7abc2b7b79dfc150ae4c;p=horde.git Optimize row removal --- diff --git a/imp/js/ViewPort.js b/imp/js/ViewPort.js index 76ed5a3a8..7e6a6aa33 100644 --- a/imp/js/ViewPort.js +++ b/imp/js/ViewPort.js @@ -409,26 +409,20 @@ var ViewPort = Class.create({ this.isbusy = true; opts = opts || {}; - var args, - i = 0, - visible = vs.get('div'), - vsize = visible.size(); + var args = { duration: 0.2, to: 0.01 }, + visible = vs.get('div'); this.deselect(vs); // If we have visible elements to remove, only call refresh after // the last effect has finished. - if (vsize) { + if (visible.size()) { // Set 'to' to a value slightly above 0 to prevent fade() // from auto hiding. Hiding is unnecessary, since we will be // removing from the document shortly. - args = { duration: 0.2, to: 0.01 }; - visible.each(function(v) { - if (++i == vsize) { - args.afterFinish = this._removeids.bind(this, vs, opts); - } - v.fade(args); - }, this); + visible.slice(0, -1).invoke('fade', args); + args.afterFinish = this._removeids.bind(this, vs, opts); + visible.last().fade(args); } else { this._removeids(vs, opts); }