Bug 122755

Summary: DOM event does not bubble in off-DOM element
Product: WebKit Reporter: Paul Miller <paul+bugs>
Component: UI EventsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED CONFIGURATION CHANGED    
Severity: Normal CC: ahmad.saleem792, ap, wenson_hsieh
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   

Paul Miller
Reported 2013-10-14 08:48:59 PDT
DOM events don't bubble in off-DOM elements. Here's the code: ``` var log = function(event) {console.log('Clicked on div', event);}; // Create DOM element. var div = document.createElement('div'); // Don't append it to DOM. Though it works if we append it there. // document.body.appendChild(div); div.innerHTML = '<a id="outer"><span class="inner">yo</span></a>'; // Does not work. div.addEventListener('click', log); div.querySelector('#outer').click(); ``` off-DOM event does not bubble up. Works fine in Firefox.
Attachments
Paul Miller
Comment 1 2013-10-14 08:53:27 PDT
Here's DOM events spec: http://www.w3.org/TR/DOM-Level-3-Events/#bubble-phase Bubbling should end with defaultView. Or, in the off-DOM case it still should bubble. >Once determined, the propagation path must not be changed; for DOM implementations, this applies even if an element in the propagation path is moved within the DOM. or removed from the DOM.
Ahmad Saleem
Comment 2 2022-09-29 15:36:02 PDT
Link - https://jsfiddle.net/rgtvmkx2/ ** Chrome Canary 108 ** "Clicked on div", [object PointerEvent] { *** Safari 16 *** "Clicked on div", [object MouseEvent] { *** Firefox Nightly 107 *** "Clicked on div", [object MouseEvent] { _____ Anything else required? Thanks!
Alexey Proskuryakov
Comment 3 2022-09-29 18:03:27 PDT
These results are a pass for this bug. Thank you for testing!
Note You need to log in before you can comment on or make changes to this bug.