diff options
author | Paul Bakaus <paul.bakaus@googlemail.com> | 2008-07-14 14:21:07 +0000 |
---|---|---|
committer | Paul Bakaus <paul.bakaus@googlemail.com> | 2008-07-14 14:21:07 +0000 |
commit | c54f6ba62efb9c59cc846a0ec9e90750a93eab91 (patch) | |
tree | a57780e9e10e7f4a5ac572e40c942e3e2323e639 | |
parent | d28b09a9848a55fab2d1230c3dc95dc2198fb4f5 (diff) | |
download | jquery-ui-c54f6ba62efb9c59cc846a0ec9e90750a93eab91.tar.gz jquery-ui-c54f6ba62efb9c59cc846a0ec9e90750a93eab91.zip |
core: added :data selector that matches elements that have data for a given key.
droppable: removed the addition of "ui-droppable" class which greatly improves intialization time for IE6/7 and FF2
-rw-r--r-- | ui/ui.core.js | 5 | ||||
-rw-r--r-- | ui/ui.droppable.js | 21 |
2 files changed, 13 insertions, 13 deletions
diff --git a/ui/ui.core.js b/ui/ui.core.js index 00167f1e7..2ed32184d 100644 --- a/ui/ui.core.js +++ b/ui/ui.core.js @@ -9,6 +9,11 @@ */ ;(function($) { +// This adds a selector to check if data exists. +jQuery.extend(jQuery.expr[':'], { + data: "jQuery.data(a, m[3])" +}); + $.ui = { plugin: { add: function(module, option, set) { diff --git a/ui/ui.droppable.js b/ui/ui.droppable.js index 6d3e159fa..e3cb08873 100644 --- a/ui/ui.droppable.js +++ b/ui/ui.droppable.js @@ -16,17 +16,12 @@ $.widget("ui.droppable", { init: function() { - this.element.addClass("ui-droppable"); this.isover = 0; this.isout = 1; - - //Prepare the passed options - var o = this.options, accept = o.accept; - o = $.extend(o, { - accept: o.accept && o.accept.constructor == Function ? o.accept : function(d) { - return $(d).is(accept); - } - }); - + + this.options.accept = this.options.accept && this.options.accept.constructor == Function ? this.options.accept : function(d) { + return d.is(accept); + }; + //Store the droppable's proportions this.proportions = { width: this.element[0].offsetWidth, height: this.element[0].offsetHeight }; @@ -52,7 +47,7 @@ $.widget("ui.droppable", { drop.splice(i, 1); this.element - .removeClass("ui-droppable ui-droppable-disabled") + .removeClass("ui-droppable-disabled") .removeData("droppable") .unbind(".droppable"); }, @@ -84,7 +79,7 @@ $.widget("ui.droppable", { if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return false; // Bail if draggable and droppable are same element var childrenIntersection = false; - this.element.find(".ui-droppable").not(".ui-draggable-dragging").each(function() { + this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function() { var inst = $.data(this, 'droppable'); if(inst.options.greedy && $.ui.intersect(draggable, $.extend(inst, { offset: inst.element.offset() }), inst.options.tolerance)) { childrenIntersection = true; return false; @@ -222,7 +217,7 @@ $.ui.ddmanager = { var parentInstance; if (this.options.greedy) { - var parent = this.element.parents('.ui-droppable:eq(0)'); + var parent = this.element.parents(':data(droppable):eq(0)'); if (parent.length) { parentInstance = $.data(parent[0], 'droppable'); parentInstance.greedyChild = (c == 'isover' ? 1 : 0); |