Bug 122755
Summary: | DOM event does not bubble in off-DOM element | ||
---|---|---|---|
Product: | WebKit | Reporter: | Paul Miller <paul+bugs> |
Component: | UI Events | Assignee: | 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
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 | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Paul Miller
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
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
These results are a pass for this bug. Thank you for testing!