Skip to content
Browse files

Use numeric sort when removing dom-repeat instances

Fixes #2297
  • Loading branch information...
1 parent a42ca09 commit fccbd8a333c6ff49faab9a03062180d29c74144d @azakus azakus committed
Showing with 6 additions and 1 deletion.
  1. +6 −1 src/lib/template/dom-repeat.html
View
7 src/lib/template/dom-repeat.html
@@ -402,6 +402,10 @@
return this.collection.getKey(a) - this.collection.getKey(b);
},
+ _numericSort: function(a, b) {
+ return a - b;
+ },
+
// Render method 2: incremental update using splices with user sort applied
// ----
// Removed/added keys are deduped, all removed rows are detached and pooled
@@ -438,7 +442,8 @@
if (removedIdxs.length) {
// Sort removed instances idx's then remove backwards,
// so we don't invalidate instance index
- removedIdxs.sort();
+ // use numeric sort, default .sort is alphabetic
+ removedIdxs.sort(this._numericSort);
for (var i=removedIdxs.length-1; i>=0 ; i--) {
var idx = removedIdxs[i];
// Removed idx may be undefined if item was previously filtered out

0 comments on commit fccbd8a

Please sign in to comment.
Something went wrong with that request. Please try again.