Bug Tracker

Changeset 5268

Show
Ignore:
Timestamp:
04/18/08 01:48:24 (8 months ago)
Author:
scott.gonzalez
Message:

UI Droppable: Fixed #2670: Proper order of over/out events for greedy droppables.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/ui/ui.droppable.js

    r5259 r5268  
    261261                if(!c) return; 
    262262                 
    263                 var instance = $.data(this.element[0], 'droppable'); 
    264                 if (instance.options.greedy) { 
    265                     this.element.parents('.ui-droppable:eq(0)').each(function() { 
    266                         var parent = this; 
    267                         $.each($.ui.ddmanager.droppables, function() { 
    268                             if (this.element[0] != parent) return; 
    269                             this[c] = 0; 
    270                             this[c == 'isout' ? 'isover' : 'isout'] = 1; 
    271                             this.greedyChild = (c == 'isover' ? 1 : 0); 
    272                             this[c == 'isout' ? 'over' : 'out'].call(this, e); 
    273                             return false; 
    274                         }); 
    275                     }); 
     263                var parentInstance; 
     264                if (this.options.greedy) { 
     265                    var parent = this.element.parents('.ui-droppable:eq(0)'); 
     266                    if (parent.length) { 
     267                        parentInstance = $.data(parent[0], 'droppable'); 
     268                        parentInstance.greedyChild = (c == 'isover' ? 1 : 0); 
     269                    } 
     270                } 
     271                 
     272                // we just moved into a greedy child 
     273                if (parentInstance && c == 'isover') { 
     274                    parentInstance['isover'] = 0; 
     275                    parentInstance['isout'] = 1; 
     276                    parentInstance.out.call(parentInstance, e); 
    276277                } 
    277278                 
     
    279280                this[c == "isover" ? "over" : "out"].call(this, e); 
    280281                 
     282                // we just moved out of a greedy child 
     283                if (parentInstance && c == 'isout') { 
     284                    parentInstance['isout'] = 0; 
     285                    parentInstance['isover'] = 1; 
     286                    parentInstance.over.call(parentInstance, e); 
     287                } 
    281288            }); 
    282289