Results 1 to 3 of 3

Thread: [OPEN-1260] Ext.id method errors when passed DOM node of type textnode

Hybrid View

Previous Post Previous Post   Next Post Next Post
    Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha User
    Join Date
    Sep 2007
    Posts
    4
    Vote Rating
    0
      0  

    Default [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.

    Code:
    Ext.enableNestedListenerRemoval = true;
    Ext.removeNode(domNode); //where domNode has at least one textNode child
    If formDiv contains a textNode element, the error is triggered.


    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;
            },

  2. #2
    Ext User
    Join Date
    Jul 2007
    Posts
    1
    Vote Rating
    0
      0  

    Default 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).

  3. #3
    Sencha User
    Join Date
    Apr 2007
    Location
    Beijing,China
    Posts
    11
    Vote Rating
    0
      0  

    Default 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);
            }
        }
    });

Similar Threads

  1. Errors when open Ext.Window with htmleditor
    By Rafael in forum Ext 3.x: Help & Discussion
    Replies: 14
    Last Post: 15 May 2009, 1:47 PM
  2. [SVN 1260] ext-base adapter busted
    By Saeven in forum Ext 2.x: Bugs
    Replies: 0
    Last Post: 22 Oct 2007, 9:52 AM
  3. Process method result before it is passed
    By 72 in forum Community Discussion
    Replies: 10
    Last Post: 12 May 2007, 8:17 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •