diff options
author | Eduardo Lundgren <eduardolundgren@gmail.com> | 2008-09-19 15:38:50 +0000 |
---|---|---|
committer | Eduardo Lundgren <eduardolundgren@gmail.com> | 2008-09-19 15:38:50 +0000 |
commit | eb689bb86c46b2e71b03e9391a986634e627493b (patch) | |
tree | 7f7cd7ec959959d28f42f86e118d8dc62bfd13c4 | |
parent | 5bdcacd1f6ad962d813cc7d839a47a44545cfb81 (diff) | |
download | jquery-ui-eb689bb86c46b2e71b03e9391a986634e627493b.tar.gz jquery-ui-eb689bb86c46b2e71b03e9391a986634e627493b.zip |
Sortables - Avoid inline script execution on every sort
-rw-r--r-- | ui/ui.sortable.js | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/ui/ui.sortable.js b/ui/ui.sortable.js index ac99c6594..c459f2244 100644 --- a/ui/ui.sortable.js +++ b/ui/ui.sortable.js @@ -298,7 +298,14 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, { o.placeholder = { element: function() { var el = $(document.createElement(self.currentItem[0].nodeName)).addClass(className || "ui-sortable-placeholder")[0]; - if(!className) { el.style.visibility = "hidden"; el.innerHTML = self.currentItem[0].innerHTML; }; + + if(!className) { + el.style.visibility = "hidden"; + document.body.appendChild(el); + el.innerHTML = self.currentItem[0].innerHTML; + document.body.removeChild(el); + }; + return el; }, update: function(container, p) { @@ -309,10 +316,10 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, { }; } - self.placeholder = $(o.placeholder.element.call(self.element, self.currentItem)).appendTo(self.currentItem.parent()); - self.currentItem.before(self.placeholder); + self.placeholder = $(o.placeholder.element.call(self.element, self.currentItem)) + self.currentItem.parent()[0].appendChild(self.placeholder[0]); + self.placeholder[0].parentNode.insertBefore(self.placeholder[0], self.currentItem[0]); o.placeholder.update(self, self.placeholder); - }, _contactContainers: function(e) { |