diff --git a/src/lib/template/dom-repeat.html b/src/lib/template/dom-repeat.html index b8ff7c8862..dd3d42b9f0 100644 --- a/src/lib/template/dom-repeat.html +++ b/src/lib/template/dom-repeat.html @@ -415,12 +415,13 @@ } this._keySplices = []; this._indexSplices = []; - // Update final _keyToInstIdx, instance indices, and replace placeholders + // Update final _keyToInstIdx and instance indices, and + // upgrade/downgrade placeholders var keyToIdx = this._keyToInstIdx = {}; for (var i=this._instances.length-1; i>=0; i--) { var inst = this._instances[i]; if (inst.isPlaceholder && i=this._limit) { inst = this._downgradeInstance(i, inst.__key__); } @@ -484,6 +485,8 @@ if (!inst.isPlaceholder && i < this._limit) { inst.__setProperty(this.as, c.getItem(key), true); } + } else if (i < this._limit) { + this._insertInstance(i, key); } else { this._insertPlaceholder(i, key); } @@ -646,7 +649,7 @@ }); }, - _generateInstance: function(idx, key) { + _stampInstance: function(idx, key) { var model = { __key__: key }; @@ -655,7 +658,7 @@ return this.stamp(model); }, - _upgradePlaceholder: function(idx, key) { + _insertInstance: function(idx, key) { var inst = this._pool.pop(); if (inst) { // TODO(kschaaf): If the pool is shared across turns, parentProps @@ -663,7 +666,7 @@ inst.__setProperty(this.as, this.collection.getItem(key), true); inst.__setProperty('__key__', key, true); } else { - inst = this._generateInstance(idx, key); + inst = this._stampInstance(idx, key); } var beforeRow = this._instances[idx + 1 ]; var beforeNode = beforeRow && !beforeRow.isPlaceholder ? beforeRow._children[0] : this;