Bug 81564 - Events do not propagate in disconnected DOM trees
Summary: Events do not propagate in disconnected DOM trees
Status: RESOLVED CONFIGURATION CHANGED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
: 110353 113336 114023 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-03-19 14:28 PDT by Erik Arvidsson
Modified: 2022-10-23 12:23 PDT (History)
9 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Erik Arvidsson 2012-03-19 14:28:53 PDT
Given a disconnected DOM tree, we should still do the event propagation.

var parent = document.createElement('div');
var child = document.createElement('div');
parent.addEventListener('foo', function(e) { alert(e)}, true);
var event = document.createEvent('Event');
event.initEvent('foo', true, true);
parent.appendChild(child);
child.dispatchEvent(event)

Opera and FIrefox both alert here.
Comment 1 Adam Klein 2012-03-19 14:45:46 PDT
This seems to be due to the inDocument() check at the top of EventDispatcher::ensureEventAncestors:

http://trac.webkit.org/browser/trunk/Source/WebCore/dom/EventDispatcher.cpp#L235

It's been around a long time, dating back to when event dispatch was still in Node.cpp.
Comment 2 Alexey Proskuryakov 2012-03-19 15:47:03 PDT
What does IE do? If IE and WebKit agree, it would take much more than just Firefox and Opera opinion to make this change necessary.
Comment 3 Alexey Proskuryakov 2013-02-20 12:55:53 PST
*** Bug 110353 has been marked as a duplicate of this bug. ***
Comment 4 Erik Arvidsson 2013-03-26 19:31:25 PDT
(In reply to comment #2)
> What does IE do? If IE and WebKit agree, it would take much more than just Firefox and Opera opinion to make this change necessary.

IE passes the test in bug 110353. This makes WebKit the odd man out.
Comment 5 Alexey Proskuryakov 2013-03-26 20:19:03 PDT
*** Bug 113336 has been marked as a duplicate of this bug. ***
Comment 6 David Kilzer (:ddkilzer) 2013-04-09 13:43:53 PDT
*** Bug 114023 has been marked as a duplicate of this bug. ***
Comment 7 David Kilzer (:ddkilzer) 2013-04-09 13:44:37 PDT
<rdar://problem/13178101>
Comment 8 Lucas Forschler 2019-02-06 09:02:47 PST
Mass moving XML DOM bugs to the "DOM" Component.
Comment 9 Ahmad Saleem 2022-10-22 14:37:42 PDT
Chrome / Blink fixed this in following commit - https://src.chromium.org/viewvc/blink?view=revision&revision=198153
Comment 10 Alexey Proskuryakov 2022-10-23 12:23:42 PDT
We must have fixed this at some point too, the test passes in Safari 16.