Bug Tracker

Ticket #2122: uidroppable-fix_element_comparer_and_accept_fn.patch

File uidroppable-fix_element_comparer_and_accept_fn.patch, 2.8 kB (added by mnichols, 1 year ago)

This patch fixes element comparisons on droppable in the trunk and also extends the accept function argument

  • ui.droppable.js

     
    6666        over: function(e) { 
    6767 
    6868            var draggable = $.ui.ddmanager.current; 
    69             if (!draggable || draggable.element == this.element) return; // Bail if draggable and droppable are same element 
    70              
    71             if (this.options.accept(draggable.element)) { 
     69            if (!draggable || $(draggable.element)[0] == $(this.element)[0]) return; // Bail if draggable and droppable are same element             
     70            if (this.options.accept(this.ui(draggable))) { 
    7271                $.ui.plugin.call(this, 'over', [e, this.ui(draggable)]); 
    7372                $(this.element).triggerHandler("dropover", [e, this.ui(draggable)], this.options.over); 
    7473            } 
     
    7776        out: function(e) { 
    7877 
    7978            var draggable = $.ui.ddmanager.current; 
    80             if (!draggable || draggable.element == this.element) return; // Bail if draggable and droppable are same element 
     79            if (!draggable || $(draggable.element)[0] == $(this.element)[0]) return; // Bail if draggable and droppable are same element 
    8180 
    82             if (this.options.accept(draggable.element)) { 
     81            if (this.options.accept(this.ui(draggable))) { 
    8382                $.ui.plugin.call(this, 'out', [e, this.ui(draggable)]); 
    8483                $(this.element).triggerHandler("dropout", [e, this.ui(draggable)], this.options.out); 
    8584            } 
     
    8887        drop: function(e) { 
    8988 
    9089            var draggable = $.ui.ddmanager.current; 
    91             if (!draggable || draggable.element == this.element) return; // Bail if draggable and droppable are same element 
     90            if (!draggable || $(draggable.element)[0] == $(this.element)[0]) return; // Bail if draggable and droppable are same element 
    9291             
    93             if(this.options.accept(draggable.element)) { 
     92            if(this.options.accept(this.ui(draggable))) { 
    9493                $.ui.plugin.call(this, 'drop', [e, this.ui(draggable)]); 
    9594                $(this.element).triggerHandler("drop", [e, this.ui(draggable)], this.options.drop); 
    9695            } 
     
    163162                if(m[i].item.disabled) continue; 
    164163                m[i].offset = $(m[i].item.element).offset(); 
    165164                 
    166                 if (t && m[i].item.options.accept(t.element)) //Activate the droppable if used directly from draggables 
     165                if (t && m[i].item.options.accept.call(m[i].item,m[i].item.ui(t))) //Activate the droppable if used directly from draggables 
    167166                    m[i].item.activate.call(m[i].item, e); 
    168167                     
    169168            } 
     
    175174                 
    176175                if (!this.item.disabled && $.ui.intersect(draggable, this, this.item.options.tolerance)) 
    177176                    this.item.drop.call(this.item, e); 
    178                      
    179                 if (!this.item.disabled && this.item.options.accept(draggable.element)) { 
     177                 
     178                if (!this.item.disabled && this.item.options.accept.call(this.item,this.item.ui(draggable))) { 
    180179                    this.out = 1; this.over = 0; 
    181180                    this.item.deactivate.call(this.item, e); 
    182181                }