From ee86bc2bbcc2b3d1c173dda5c942da4d948b869c Mon Sep 17 00:00:00 2001 From: Tim van der Lippe Date: Tue, 3 May 2016 13:40:18 +0200 Subject: [PATCH 1/3] Fix compilation on ES5 for Polymer --- Sortable.html | 102 +++++++++++++++++++++++++------------------------- 1 file changed, 52 insertions(+), 50 deletions(-) diff --git a/Sortable.html b/Sortable.html index 77994ce..4ec31b8 100644 --- a/Sortable.html +++ b/Sortable.html @@ -7,11 +7,12 @@ From 643d9afe85d31e3cae4eb6277868a8efacc02876 Mon Sep 17 00:00:00 2001 From: Tim van der Lippe Date: Tue, 3 May 2016 15:56:37 +0200 Subject: [PATCH 2/3] Fix issue with dragEl undefined when moving with a Polymer element --- Sortable.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Sortable.js b/Sortable.js index 52b2d2d..55e8f2f 100644 --- a/Sortable.js +++ b/Sortable.js @@ -744,8 +744,9 @@ target.parentNode.insertBefore(dragEl, after ? nextSibling : target); } } - - parentEl = dragEl.parentNode; // actualization + if (dragEl) { + parentEl = dragEl.parentNode; // actualization + } this._animate(dragRect, dragEl); this._animate(targetRect, target); From 238216d8c94009947505cef8ffd4d1cf9d7fee10 Mon Sep 17 00:00:00 2001 From: Tim van der Lippe Date: Wed, 22 Jun 2016 17:27:47 +0200 Subject: [PATCH 3/3] Fix feedback --- Sortable.html | 22 +++++++++++----------- Sortable.js | 5 ++--- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/Sortable.html b/Sortable.html index 4ec31b8..bb7bc22 100644 --- a/Sortable.html +++ b/Sortable.html @@ -64,13 +64,13 @@ options[key] = this[key]; }.bind(this)); - var self = this; + var _this = this; var eventCallbacks = { onUpdate: function (e) { if (template) { template.splice("items", e.newIndex, 0, template.splice("items", e.oldIndex, 1)[0]); } - self.fire("update", e); + _this.fire("update", e); }, onAdd: function(e) { @@ -80,42 +80,42 @@ var item = from.items[e.oldIndex]; template.splice("items", e.newIndex, 0, item); } - self.fire("add", e); + _this.fire("add", e); }, onRemove: function(e) { if (template) { template.splice("items", e.oldIndex, 1)[0]; } - self.fire("remove", e); + _this.fire("remove", e); }, onChoose: function(e) { - self.fire("choose", e); + _this.fire("choose", e); }, onStart: function(e) { - self.fire("start", e); + _this.fire("start", e); }, onEnd: function(e) { - self.fire("end", e); + _this.fire("end", e); }, onSort: function(e) { - self.fire("sort", e); + _this.fire("sort", e); }, onFilter: function(e) { - self.fire("filter", e); + _this.fire("filter", e); }, onMove: function(e) { - self.fire("move", e); + _this.fire("move", e); }, onClone: function(e) { - self.fire("clone", e); + _this.fire("clone", e); } }; diff --git a/Sortable.js b/Sortable.js index 55e8f2f..52b2d2d 100644 --- a/Sortable.js +++ b/Sortable.js @@ -744,9 +744,8 @@ target.parentNode.insertBefore(dragEl, after ? nextSibling : target); } } - if (dragEl) { - parentEl = dragEl.parentNode; // actualization - } + + parentEl = dragEl.parentNode; // actualization this._animate(dragRect, dragEl); this._animate(targetRect, target);