Bug Tracker

Ticket #9724 (closed bug: fixed)

Opened 3 years ago

Last modified 3 years ago

Infinite loop in trigger function when window.parentNode is a DOM element

Reported by: anonymous Owned by: dmethvin
Priority: low Milestone: 1.7
Component: event Version: 1.6.1
Keywords: Cc:
Blocking: Blocked by:

Description

The code at fault is:

cur = cur.parentNode || cur.ownerDocument || cur === event.target.ownerDocument && window;

The cur variable walks the DOM tree, then becomes the Document object en then the window object. When window has a parentNode variable, an infinite loop starts.

Forgetting to declare a temporary parentNode variable so it ends up in the window object is a client programmer error, but jQuery should not choke on it.

Change History

comment:1 Changed 3 years ago by dmethvin

  • Priority changed from undecided to low
  • Status changed from new to open
  • Component changed from unfiled to event

Hmmm, good point. We are using another browser sniff for a setInterval property to determine if something is a window, we can check for that, or perhaps checking for cur.nodeType===1 would be better.

In the meantime, don't declare a global with the name parentNode!

comment:2 Changed 3 years ago by dmethvin

To continue my internal dialog, we don't want to check for .nodeType===1 because someone may be depending on plain objects to bubble ... not that we formally support it, but I discussed the possibility with Yehuda a few months back. So a window test may be our best bet.

comment:3 Changed 3 years ago by dmethvin

  • Owner set to dmethvin
  • Status changed from open to assigned
  • Milestone changed from 1.next to 1.7

comment:4 Changed 3 years ago by dmethvin

  • Status changed from assigned to closed
  • Resolution set to fixed
Note: See TracTickets for help on using tickets.