diff options
author | Mike Sherov <mike.sherov@gmail.com> | 2012-10-30 22:19:49 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2012-10-30 22:24:41 -0400 |
commit | 8746042ae10070ecb3c35bd34238e146b6b2e3a5 (patch) | |
tree | 680131d4193b396f7c90156b221cd7180dbd8fff /ui | |
parent | b49e071d39795255e88b13ae172367201484c352 (diff) | |
download | jquery-ui-8746042ae10070ecb3c35bd34238e146b6b2e3a5.tar.gz jquery-ui-8746042ae10070ecb3c35bd34238e146b6b2e3a5.zip |
Dev: Standardized the droppable test suite. Fixed #8753 - Dev: Get droppable test suite to pass
Diffstat (limited to 'ui')
-rw-r--r-- | ui/jquery.ui.droppable.js | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/ui/jquery.ui.droppable.js b/ui/jquery.ui.droppable.js index 93e74d211..9086a68f2 100644 --- a/ui/jquery.ui.droppable.js +++ b/ui/jquery.ui.droppable.js @@ -14,8 +14,11 @@ * jquery.ui.mouse.js * jquery.ui.draggable.js */ + + (function( $, undefined ) { +/*jshint onevar: false, curly: false, eqeqeq: false, laxbreak: true */ $.widget("ui.droppable", { version: "@VERSION", widgetEventPrefix: "drop", @@ -156,33 +159,28 @@ $.ui.intersect = function(draggable, droppable, toleranceMode) { case 'fit': return (l <= x1 && x2 <= r && t <= y1 && y2 <= b); - break; case 'intersect': return (l < x1 + (draggable.helperProportions.width / 2) // Right Half && x2 - (draggable.helperProportions.width / 2) < r // Left Half && t < y1 + (draggable.helperProportions.height / 2) // Bottom Half && y2 - (draggable.helperProportions.height / 2) < b ); // Top Half - break; case 'pointer': var draggableLeft = ((draggable.positionAbs || draggable.position.absolute).left + (draggable.clickOffset || draggable.offset.click).left), draggableTop = ((draggable.positionAbs || draggable.position.absolute).top + (draggable.clickOffset || draggable.offset.click).top), isOver = $.ui.isOver(draggableTop, draggableLeft, t, l, droppable.proportions.height, droppable.proportions.width); return isOver; - break; case 'touch': return ( - (y1 >= t && y1 <= b) || // Top edge touching - (y2 >= t && y2 <= b) || // Bottom edge touching - (y1 < t && y2 > b) // Surrounded vertically - ) && ( - (x1 >= l && x1 <= r) || // Left edge touching - (x2 >= l && x2 <= r) || // Right edge touching - (x1 < l && x2 > r) // Surrounded horizontally - ); - break; + (y1 >= t && y1 <= b) || // Top edge touching + (y2 >= t && y2 <= b) || // Bottom edge touching + (y1 < t && y2 > b) // Surrounded vertically + ) && ( + (x1 >= l && x1 <= r) || // Left edge touching + (x2 >= l && x2 <= r) || // Right edge touching + (x1 < l && x2 > r) // Surrounded horizontally + ); default: return false; - break; } }; @@ -202,8 +200,14 @@ $.ui.ddmanager = { droppablesLoop: for (var i = 0; i < m.length; i++) { if(m[i].options.disabled || (t && !m[i].accept.call(m[i].element[0],(t.currentItem || t.element)))) continue; //No disabled and non-accepted - for (var j=0; j < list.length; j++) { if(list[j] == m[i].element[0]) { m[i].proportions.height = 0; continue droppablesLoop; } }; //Filter out elements in the current dragged item - m[i].visible = m[i].element.css("display") != "none"; if(!m[i].visible) continue; //If the element is not visible, continue + // Filter out elements in the current dragged item + for (var j=0; j < list.length; j++) { + if(list[j] == m[i].element[0]) { + m[i].proportions.height = 0; + continue droppablesLoop; + } + } + m[i].visible = m[i].element.css("display") != "none"; if(!m[i].visible) continue; //If the element is not visible, continue if(type == "mousedown") m[i]._activate.call(m[i], event); //Activate the droppable if used directly from draggables @@ -248,7 +252,7 @@ $.ui.ddmanager = { if(this.options.disabled || this.greedyChild || !this.visible) return; var intersects = $.ui.intersect(draggable, this, this.options.tolerance); - var c = !intersects && this.isover == 1 ? 'isout' : (intersects && this.isover == 0 ? 'isover' : null); + var c = !intersects && this.isover == 1 ? 'isout' : (intersects && this.isover === 0 ? 'isover' : null); if(!c) return; var parentInstance; @@ -267,8 +271,8 @@ $.ui.ddmanager = { // we just moved into a greedy child if (parentInstance && c == 'isover') { - parentInstance['isover'] = 0; - parentInstance['isout'] = 1; + parentInstance.isover = 0; + parentInstance.isout = 1; parentInstance._out.call(parentInstance, event); } @@ -277,8 +281,8 @@ $.ui.ddmanager = { // we just moved out of a greedy child if (parentInstance && c == 'isout') { - parentInstance['isout'] = 0; - parentInstance['isover'] = 1; + parentInstance.isout = 0; + parentInstance.isover = 1; parentInstance._over.call(parentInstance, event); } }); |