Bug Tracker

Ticket #2063: uidroppable121607.patch

File uidroppable121607.patch, 2.2 kB (added by mnichols, 10 months ago)

Droppable invoking using 'call' on accept callback

  • ui.droppable.js

     
    8686                var el = e.srcElement;  
    8787                do { if(el.droppable) return el; el = el.parentNode; } while (el); //This is only used in IE! references in DOM are evil! 
    8888            } 
    89             if(c && o.accept(c.element)) c.currentTarget = findCurrentTarget(e); 
     89            if(c && o.accept.call(this,c.element)) c.currentTarget = findCurrentTarget(e); 
    9090             
    9191            c.drag.apply(c, [e]); 
    9292            e.stopPropagation ? e.stopPropagation() : e.cancelBubble = true; 
     
    9696 
    9797            var c = $.ui.ddmanager.current; 
    9898            if (!c || c.element == this.element) return; // Bail if draggable and droppable are same element 
    99              
     99            c.currentTarget = this;//added 
    100100            var o = this.options; 
    101             if (o.accept(c.element)) { 
     101            if (o.accept.call(this,c.element)) { 
    102102                $.ui.plugin.call(this, 'over', [e, this.prepareCallbackObj(c)]); 
    103103                $(this.element).triggerHandler("dropover", [e, this.prepareCallbackObj(c)], o.over); 
    104104            } 
     
    107107        out: function(e) { 
    108108 
    109109            var c = $.ui.ddmanager.current; 
    110             if (!c || c.element == this.element) return; // Bail if draggable and droppable are same element 
    111  
     110            if (!c || c.element == this.element) return; // Bail if draggable and droppable are same element             
    112111            var o = this.options; 
    113             if (o.accept(c.element)) { 
     112            if (o.accept.call(this,c.element)) { 
    114113                $.ui.plugin.call(this, 'out', [e, this.prepareCallbackObj(c)]); 
    115114                $(this.element).triggerHandler("dropout", [e, this.prepareCallbackObj(c)], o.out); 
    116115            } 
     
    119118        drop: function(e) { 
    120119 
    121120            var c = $.ui.ddmanager.current; 
    122             if (!c || c.element == this.element) return; // Bail if draggable and droppable are same element 
    123              
     121            if (!c || c.element == this.element) return; // Bail if draggable and droppable are same element             
    124122            var o = this.options; 
    125             if(o.accept(c.element)) { // Fire callback 
     123            if(o.accept.call(this,c.element)) { // Fire callback 
    126124                if(o.greedy && !c.slowMode) { 
    127125                    if(c.currentTarget == this.element) { 
    128126                        $.ui.plugin.call(this, 'drop', [e, {