Skip to content

Commit 5b7f08a

Browse files
authored
Merge pull request #15 from PolymerEl/betterEventObject
add model.item in event Object
2 parents 5f97bae + 77daf3b commit 5b7f08a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

polymer-sortablejs.html

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,9 @@
9494
if (template) {
9595
var froms = e.from.querySelectorAll("template[is='dom-repeat']");
9696
var from = froms[froms.length-1];
97-
var item = from.items[e.oldIndex];
98-
template.splice("items", e.newIndex, 0, item);
97+
var model = from.modelForElement(e.item);
98+
template.splice("items", e.newIndex, 0, model.item);
99+
e.model = model;
99100
}
100101
_this.fire("add", e);
101102
},
@@ -106,7 +107,8 @@
106107
return false;
107108
}
108109
if (template) {
109-
template.splice("items", e.oldIndex, 1)[0];
110+
var item = template.splice("items", e.oldIndex, 1)[0];
111+
e.model = {item: item};
110112
}
111113
_this.fire("remove", e);
112114
},

0 commit comments

Comments
 (0)