diff --git a/src/lib/template/dom-repeat.html b/src/lib/template/dom-repeat.html index 793d49e8d7..9e5923deae 100644 --- a/src/lib/template/dom-repeat.html +++ b/src/lib/template/dom-repeat.html @@ -330,11 +330,9 @@ this._splices = []; // Update final _keyToInstIdx and instance indices var keyToIdx = this._keyToInstIdx = {}; - var keys = this._keys; - for (var i=0; i> 1; - var midKey = this._keys[mid]; + var midKey = this._instances[mid].__key__; var cmp = sortFn(c.getItem(midKey), item); if (cmp < 0) { start = mid + 1; @@ -485,26 +481,20 @@ if (idx < 0) { idx = end + 1; } - // Insert key & inst at insertion point - this._keys.splice(idx, 0, key); + // Insert instance at insertion point this._instances.splice(idx, 0, this._insertRow(idx, key, pool)); return idx; }, - // Render method 3: incremental update using splices with array sort + // Render method 3: incremental update using splices with array order // ---- // Splices are processed in order; removed rows are pooled, and added - // rows are inserted based on splice index; placeholders are used when - // inserting rows when pool is empty, and placeholders are updated to + // rows are as placeholders, and placeholders are updated to // actual rows at the end to take full advantage of removed rows _applySplicesArrayOrder: function(splices) { - var keys = this._keys; var pool = []; var c = this.collection; splices.forEach(function(s) { - // Apply splices to keys - var args = [s.index, s.removed.length].concat(s.added); - keys.splice.apply(keys, args); // Detach & pool removed instances for (var i=0; i