From 2a6a3561092a3c34d3f5c6b759e4af3ec01fcf0f Mon Sep 17 00:00:00 2001 From: Paul Bakaus Date: Wed, 19 Nov 2008 09:54:53 +0000 Subject: [PATCH] sortable: removed ui.element and ui.options from the UI object, corrected the callback for the items option, now includes event if applicable --- ui/ui.sortable.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/ui/ui.sortable.js b/ui/ui.sortable.js index 4b4d928ef..438ebe159 100644 --- a/ui/ui.sortable.js +++ b/ui/ui.sortable.js @@ -40,8 +40,6 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, { placeholder: self.placeholder || $([]), position: self.position, absolutePosition: self.positionAbs, - options: this.options, - element: this.element, item: self.currentItem, sender: inst ? inst.element : null }; @@ -206,8 +204,8 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, { return direction; }, - refresh: function() { - this._refreshItems(); + refresh: function(event) { + this._refreshItems(event); this.refreshPositions(); }, @@ -256,13 +254,13 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, { }, - _refreshItems: function() { + _refreshItems: function(event) { this.items = []; this.containers = [this]; var items = this.items; var self = this; - var queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element), this]]; + var queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]]; if(this.options.connectWith) { for (var i = this.options.connectWith.length - 1; i >= 0; i--){ @@ -270,7 +268,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, { for (var j = cur.length - 1; j >= 0; j--){ var inst = $.data(cur[j], 'sortable'); if(inst && inst != this && !inst.options.disabled) { - queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element), inst]); + queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element[0], event, { item: this.currentItem }) : $(inst.options.items, inst.element), inst]); this.containers.push(inst); } }; @@ -449,7 +447,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, { if(this.options.disabled || this.options.type == 'static') return false; //We have to refresh the items data once first - this._refreshItems(); + this._refreshItems(event); //Find out if the clicked node (or one of its parents) is a actual item in this.items var currentItem = null, self = this, nodes = $(event.target).parents().each(function() { -- 2.39.5