-
10 Sep 2010 1:18 PM #1
[OPEN-1260] Ext.id method errors when passed DOM node of type textnode
[OPEN-1260] Ext.id method errors when passed DOM node of type textnode
Bug report for ExtJS 3.2.2
if Ext.EventManager.purgeElement (recursive param set to true) is passed a DOM element that contains a DOM element childNode of nodeType 3 (textNode), the result is IE hanging forever, or an "Object method or property not found" exception.
line numbers may be off
Stack trace:
Code:Ext.EventManager.purgeElement ......var id = getId(el) //line 2323 of ext-all-debug.js ............Ext.EventManager.getId(el) .................id = Ext.id(el); //line 1950 of ext-all-debug.js ......................el.id = (prefix || "ext-gen") + (++idSeed); //line 111 of ext-base-debug.js
Instead of calling purgeElement directly with a DOM element (which may only be intended to receive Ext.Element as param), the other way this is triggered is via a call to removeNode when enableNestedListenerRemoval is true.
If formDiv contains a textNode element, the error is triggered.Code:Ext.enableNestedListenerRemoval = true; Ext.removeNode(domNode); //where domNode has at least one textNode child
in Ext.removeNode, line 346 of ext-base-debug.js appears to indicate a DOM element CAN be passed to Ext.EventManager.purgeElement. The ExtJS docs specify the node param as type: HTMLElement.
Code:if(n && n.parentNode && n.tagName != 'BODY'){ (Ext.enableNestedListenerRemoval) ? Ext.EventManager.purgeElement(n, true) : Ext.EventManager.removeAll(n); n.parentNode.removeChild(n); delete Ext.elCache[n.id]; }
PROPOSED FIX:
Either avoid passing DOM nodes to Ext.EventManager.purgeElement or avoid trying to illegally set the id of a textNode by adding this code to the Ext.id method.
Code:id : function(el, prefix){ el = Ext.getDom(el, true) || {}; //begin new code //Ensure this node isn't a textnode if(el.nodeName && el.nodeType === 3) { return; } //end new code if (!el.id) { el.id = (prefix || "ext-gen") + (++idSeed); } return el.id; },
-
28 Sep 2010 8:25 AM #2
I confirm the same issue
I confirm the same issue
However, it seems to only error in Internet Explorer. Firefox and Chrome seem to be okay with it.
Any word on a fix or workaround other than changes ext-all ourselves (which is working for now).
-
2 May 2012 7:54 PM #3
quick fix
quick fix
Use the following code to override "Ext.id", I don't want to modify ext-base.js directly.
Code:Ext.origId = Ext.id; Ext.apply(Ext, { id: function(el, prefix) { el = Ext.getDom(el, true) || {}; if(el.nodeName && el.nodeType === 3) { return; } else { return Ext.origId(el, prefix); } } });
Thank you for reporting this bug. We will make it our priority to review this report.
Similar Threads
-
Errors when open Ext.Window with htmleditor
By Rafael in forum Ext 3.x: Help & DiscussionReplies: 14Last Post: 15 May 2009, 1:47 PM -
[SVN 1260] ext-base adapter busted
By Saeven in forum Ext 2.x: BugsReplies: 0Last Post: 22 Oct 2007, 9:52 AM -
Process method result before it is passed
By 72 in forum Community DiscussionReplies: 10Last Post: 12 May 2007, 8:17 AM


Reply With Quote