PDA

View Full Version : [FIXED-253][3.0] Ext.Element anchorTo never removes window resize listener



CableDawg
17 Aug 2009, 11:42 AM
The window resize listener will continue to fire even after the element has been destroyed. Because anchorTo creates a private event listener, there is no way to remove it without clearing all resize listeners.


anchorTo : function(el, alignment, offsets, animate, monitorScroll, callback){
var me = this,
dom = me.dom;

function action(){
Ext.fly(dom).alignTo(el, alignment, offsets, animate);
Ext.callback(callback, Ext.fly(dom));
}

Ext.EventManager.onWindowResize(action, me);

if(!Ext.isEmpty(monitorScroll)){
Ext.EventManager.on(window, 'scroll', action, me,
{buffer: !isNaN(monitorScroll) ? monitorScroll : 50});
}
action.call(me); // align immediately
return me;
},

anchorTo could subscribe to its own destroy event and remove the handler that way.

Incidentally, only IE seems to have a real problem with this. Firefox seems to maintain the Element as a DOM fragment or something (like an unappended element). That allows it to still be able to call getBoundingClientRect.

IE6-8, on the other hand, throws an error when calling getBoundingClientRect, event tho the method is available.

The error occurs in the getXY method of the bridge util files.

This issue seems somewhat related to http://extjs.com/forum/showthread.php?t=43557 except that was for Window and not Element.

evant
17 Sep 2009, 3:31 AM
A new removeAnchor method has been added which will allow you to clear any anchor set.

Fix applied to svn in rev #5371 for patch release 3.1.

MarkB
28 Oct 2009, 12:38 PM
Has this patch been applied to the 2.x branch as well?

I am removing a Tab with nested form and it works fine in FF but blows up on IE.


if(g.getBoundingClientRect){m=g.getBoundingClientRect();