-
Notifications
You must be signed in to change notification settings - Fork 318
Closed
Description
If parent is a node and target’s root is a shadow-including inclusive ancestor of parent, then:
When walking up the parent chain and parent is the global object, instead of going through the (5.9.6) branch of the algorithm it goes through the (5.9.8) branch. The last tuple of all the event path, would always have it's target set to the global object. Because of this, after being dispatched the event.target is always the global object.
The following test fails: Event-defaultPrevented-after-dispatch.html
test(function() {
var EVENT = "foo";
var TARGET = document.getElementById("target");
var evt = document.createEvent("Event");
evt.initEvent(EVENT, true, true);
TARGET.addEventListener(EVENT, this.step_func(function(e) {
// <-- OK: event.target === TARGET
e.preventDefault();
assert_true(e.defaultPrevented, "during dispatch");
}), true);
TARGET.dispatchEvent(evt);
assert_true(evt.defaultPrevented, "after dispatch");
assert_equals(evt.target, TARGET); // <-- FAILS: event.target === window
assert_equals(evt.srcElement, TARGET);
}, "Default prevention via preventDefault");In order to get around this issue the 5.9.6 should also check if parent is the global object.
Metadata
Metadata
Assignees
Labels
No labels