From: Alan Knowles Date: Fri, 2 Jul 2021 07:25:09 +0000 (+0800) Subject: fix listeners X-Git-Url: http://git.roojs.org/?p=roojs1;a=commitdiff_plain;h=ac9dfb4f4a1fdfc664ce796f99599924cdc3a9c5 fix listeners --- diff --git a/docs/src/Roo_Element.js.html b/docs/src/Roo_Element.js.html index 21b4cfaa36..789bf1036f 100644 --- a/docs/src/Roo_Element.js.html +++ b/docs/src/Roo_Element.js.html @@ -89,6 +89,9 @@ if(opt.anim.isAnimated()){ { var dom = typeof element == "string" ? document.getElementById(element) : element; + + this.listeners = {}; + if(!dom){ // invalid id/element return null; } @@ -109,8 +112,8 @@ if(opt.anim.isAnimated()){ */ this.id = id || Roo.id(dom); - this.listeners = {}; - }; + return this; // assumed for cctor? + }; var El = Roo.Element; @@ -1240,7 +1243,7 @@ if(opt.anim.isAnimated()){ */ removeListener : function(eventName, fn, scope){ Roo.EventManager.removeListener(this.dom, eventName, fn); - if (typeof(this.listeners[eventName]) == 'undefined') { + if (typeof(this.listeners) == 'undefined' || typeof(this.listeners[eventName]) == 'undefined') { return this; } this.listeners[eventName].removeListener(fn, scope); @@ -2381,7 +2384,7 @@ if(opt.anim.isAnimated()){ Roo.EventManager.removeResizeListener(this.fitToParentDelegate); // always remove previous fitToParent delegate from onWindowResize this.fitToParentDelegate = Roo.emptyFn; // remove reference to previous delegate if (monitorResize === true && !this.dom.parentNode) { // check if this Element still exists - return; + return this; } var p = Roo.get(targetParent || this.dom.parentNode); this.setSize(p.getComputedWidth() - p.getFrameWidth('lr'), p.getComputedHeight() - p.getFrameWidth('tb')); diff --git a/roojs-core-debug.js b/roojs-core-debug.js index 3853711378..7f8d0f429a 100644 --- a/roojs-core-debug.js +++ b/roojs-core-debug.js @@ -8297,7 +8297,7 @@ if(opt.anim.isAnimated()){ //action on double tap goes below }, - + /** * Removes an event handler from this element * @param {String} eventName the type of event to remove diff --git a/roojs-debug.js b/roojs-debug.js index 9499a43114..d6570f6cdb 100644 --- a/roojs-debug.js +++ b/roojs-debug.js @@ -8297,7 +8297,7 @@ if(opt.anim.isAnimated()){ //action on double tap goes below }, - + /** * Removes an event handler from this element * @param {String} eventName the type of event to remove