OpenLayers OpenLayers

Ticket #604: eventsDestroy.patch

File eventsDestroy.patch, 1.2 kB (added by euzuro, 2 years ago)

fix

  • lib/OpenLayers/Events.js

    old new  
    275275     */ 
    276276    destroy: function () { 
    277277        if (this.element) { 
    278             this.detachFromElement(); 
     278            OpenLayers.Event.stopObservingElement(this.element); 
    279279        } 
    280280        this.element = null; 
    281281 
     
    304304        // disable dragstart in IE so that mousedown/move/up works normally 
    305305        OpenLayers.Event.observe(element, "dragstart", OpenLayers.Event.stop); 
    306306    }, 
    307      
    308     /** 
    309      * @private 
    310      */ 
    311     detachFromElement: function () { 
    312         for (var i = 0; i < this.BROWSER_EVENTS.length; i++) { 
    313             var eventType = this.BROWSER_EVENTS[i]; 
    314307 
    315             OpenLayers.Event.stopObserving( 
    316                 this.element, eventType, this.eventHandler); 
    317         } 
    318  
    319         // re-enable dragstart in IE 
    320         OpenLayers.Event.stopObserving( 
    321             this.element, "dragstart", OpenLayers.Event.stop); 
    322     }, 
    323  
    324308    /** 
    325309     * @param {String} type Name of the event to register 
    326310     * @param {Object} obj The object to bind the context to for the callback#.