Skip to content

Commit

Permalink
Workaround for Polymer.Collection splice issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin Moore committed Apr 18, 2016
1 parent 3a6cb4b commit 8e3c403
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/mm-item-recycler/mm-item-recycler.js
Original file line number Diff line number Diff line change
Expand Up @@ -298,10 +298,12 @@ found here: https://github.com/Polymer/core-list
var count = 0|(binds && binds.length);
var index = 0;
var bound = null;
var convert = 0|false;

if (modelChanged) {
if (path.charCodeAt(offset) === "#".charCodeAt(0)) {
offset += 1;
convert = 0|true;
}

if (delimiter < offset) {
Expand All @@ -313,6 +315,14 @@ found here: https://github.com/Polymer/core-list
}

if (!isNaN(num)) {
if (convert) {
num = this.data.indexOf(Polymer.Collection.get(this.data).getItem("#"+num));
if (num < 0 ||
num > this.data.length - 1) {
throw new Error("Polymer.Collection splicing likely caused a fatal inconsistency");
}
}

for (index; index < count; index++) {
bound = binds[index];

Expand Down

0 comments on commit 8e3c403

Please sign in to comment.