Results 1 to 2 of 2

Thread: Possible undefined parentNode in Ext.event.publisher.Focus.processFocusIn

    Success! Looks like we've fixed this one. According to our records the fix was applied for EXTJS-19870 in 5.1.3.
  1. #1
    Sencha Premium User westy's Avatar
    Join Date
    Feb 2009
    Location
    Bath, UK
    Posts
    1,035

    Default Possible undefined parentNode in Ext.event.publisher.Focus.processFocusIn

    We see an exception sometimes when clicking around on pies and pie legends.
    I notice that this issue is still relevant in the Ext 6 src.

    Reassuringly, the change we have made is the same as in an identical clode block higher up in the method.

    Sorry, not crafted a fiddle... the change is obvious from inspection.

    Code:
        Ext.define('Altus.overrides.event.publisher.Focus', {
            override: 'Ext.event.publisher.Focus',
    
    
            /**
             * Override for processFocusIn function which checks if node exists when pushing node into targets array as this node can be null.
             */
            processFocusIn: function(e, fromElement, toElement, invokeAfter) {
                var me = this,
                    commonAncestor = Ext.Element.getCommonAncestor(toElement, fromElement, true),
                    node, targets = [],
                    event, el, id;
    
    
                // Gather targets for focusleave event from the fromElement to the parentNode (not inclusive)
                for (node = fromElement; node && node !== commonAncestor; node = node.parentNode) {
                    targets.push(node);
                }
    
    
                // Publish the focusleave event for the bubble hierarchy
                if (targets.length) {
                    event = me.createSyntheticEvent('focusleave', e, fromElement, toElement);
                    me.publish('focusleave', targets, event);
                    targets.length = 0;
                    if (event.isStopped) {
                        return;
                    }
                }
    
    
                // Added check if node exists
                for (node = toElement; node && node !== commonAncestor; node = node.parentNode) {
                    targets.push(node);
                }
    
    
                // Publish the focusleave event for the bubble hierarchy
                event = me.createSyntheticEvent('focusenter', e, toElement, fromElement);
                me.publish('focusenter', targets, event);
                if (event.isStopped) {
                    return;
                }
    
    
                if (invokeAfter) {
                    me.afterEvent(e);
                }
    
    
                Ext.GlobalEvents.fireEvent('focus', {
                    event: event,
                    toElement: toElement,
                    fromElement: fromElement
                });
            }
        });
    Cheers,
    Westy
    Product Architect
    Altus Ltd.

  2. #2
    Sencha - Ext JS Dev Team nohuhu's Avatar
    Join Date
    Jun 2011
    Location
    Redwood coast
    Posts
    401

    Default

    Thanks for the report! I have opened a bug in our bug tracker.

Similar Threads

  1. Replies: 3
    Last Post: 16 Mar 2015, 11:12 AM
  2. Cannot read property 'parentNode' of undefined, urgent
    By ranajyotic in forum Ext: Discussion
    Replies: 2
    Last Post: 19 Dec 2014, 12:18 AM
  3. [INFOREQ] [ST 2.1.0-b2] Loader paths for event/publisher/Dom.js not found
    By wprater in forum Sencha Touch 2.x: Bugs
    Replies: 7
    Last Post: 26 Sep 2012, 10:50 AM
  4. [INFOREQ] Tree navigation - me.dom.parentNode is undefined
    By stevanicus in forum Ext:Bugs
    Replies: 2
    Last Post: 21 Jun 2012, 12:47 AM
  5. TypeError: Cannot read property 'parentNode' of undefined
    By zurdophp in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 2 Sep 2010, 5:58 AM

Posting Permissions

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