|
268 | 268 | this._error(this._logf('dom-repeat', 'expected array for `items`,' +
|
269 | 269 | ' found', this.items));
|
270 | 270 | }
|
271 |
| - this._splices = []; |
| 271 | + this._keySplices = []; |
| 272 | + this._indexSplices = []; |
272 | 273 | this._needFullRefresh = true;
|
273 | 274 | this._debounceTemplate(this._render);
|
274 | 275 | } else if (change.path == 'items.splices') {
|
275 |
| - this._splices = this._splices.concat(change.value.keySplices); |
| 276 | + this._keySplices = this._keySplices.concat(change.value.keySplices); |
| 277 | + this._indexSplices = this._indexSplices.concat(change.value.indexSplices); |
276 | 278 | this._debounceTemplate(this._render);
|
277 | 279 | } else { // items.*
|
278 | 280 | // slice off 'items.' ('items.'.length == 6)
|
|
303 | 305 | },
|
304 | 306 |
|
305 | 307 | /**
|
306 |
| - * Forces the element to render its content. Normally rendering is |
307 |
| - * asynchronous to a provoking change. This is done for efficiency so |
308 |
| - * that multiple changes trigger only a single render. The render method |
309 |
| - * should be called if, for example, template rendering is required to |
| 308 | + * Forces the element to render its content. Normally rendering is |
| 309 | + * asynchronous to a provoking change. This is done for efficiency so |
| 310 | + * that multiple changes trigger only a single render. The render method |
| 311 | + * should be called if, for example, template rendering is required to |
310 | 312 | * validate application state.
|
311 | 313 | */
|
312 | 314 | render: function() {
|
|
324 | 326 | this._needFullRefresh = false;
|
325 | 327 | } else {
|
326 | 328 | if (this._sortFn) {
|
327 |
| - this._applySplicesUserSort(this._splices); |
| 329 | + this._applySplicesUserSort(this._keySplices); |
328 | 330 | } else {
|
329 | 331 | if (this._filterFn) {
|
330 | 332 | // TODK(kschaaf): Filtering using array sort takes slow path
|
331 | 333 | this._applyFullRefresh();
|
332 | 334 | } else {
|
333 |
| - this._applySplicesArrayOrder(this._splices); |
| 335 | + this._applySplicesArrayOrder(this._indexSplices); |
334 | 336 | }
|
335 | 337 | }
|
336 | 338 | }
|
337 |
| - this._splices = []; |
| 339 | + this._keySplices = []; |
| 340 | + this._indexSplices = []; |
338 | 341 | // Update final _keyToInstIdx and instance indices
|
339 | 342 | var keyToIdx = this._keyToInstIdx = {};
|
340 | 343 | for (var i=0; i<this._instances.length; i++) {
|
|
511 | 514 | }
|
512 | 515 | this._instances.splice(s.index, s.removed.length);
|
513 | 516 | // Insert placeholders for new rows
|
514 |
| - for (var i=0; i<s.added.length; i++) { |
| 517 | + for (var i=0; i<s.addedKeys.length; i++) { |
515 | 518 | var inst = {
|
516 | 519 | isPlaceholder: true,
|
517 |
| - key: s.added[i] |
| 520 | + key: s.addedKeys[i] |
518 | 521 | };
|
519 | 522 | this._instances.splice(s.index + i, 0, inst);
|
520 | 523 | }
|
|
0 commit comments