Topic: Bug draggable plugin: please turn off "resize" in dispose()
                  
                  cdc
                  free
                  asked 4 years ago
                
Actual behavior
Resize event is turn on, but does not turn off in dispose...
and therefore it generates multiple errors once the element has been disposed.
/src/plugins/drag-and-drop/js/draggable.js
_dragTriggers() {
    EventHandler.on(this.dragEl, 'touchstart', this._dragStart);
    EventHandler.on(this.dragEl, 'mousedown', this._dragStart);
    EventHandler.on(window, 'resize', this._takeAgainCoordinates); 
 }
dispose() {
    EventHandler.off(this.dragEl, 'touchstart', this._dragStart);
    EventHandler.off(this.dragEl, 'mousedown', this._dragStart);
    Data.removeData(this._element, DATA_KEY);
    this._element = null;  }
Expected behavior
    dispose() {
        EventHandler.off(this.dragEl, 'touchstart', this._dragStart);
        EventHandler.off(this.dragEl, 'mousedown', this._dragStart);
        Data.removeData(this._element, DATA_KEY);
        EventHandler.off(window, 'resize', this._takeAgainCoordinates); // <= *THIS*
        this._element = null; }
Thanks
                      
                        Add comment
                      
                    
                  
                FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Status
              Answered
Specification of the issue
              - ForumUser: Free
 - Premium support: No
 - Technology: MDB Standard
 - MDB Version: MDB5 3.8.1
 - Device: macbook pro
 - Browser: chrome
 - OS: big sur
 - Provided sample code: No
 - Provided link: No
 
Tags