Event dispatch rewritten to resemble spec more often, activate on clicks better

This commit is contained in:
Patrick Shaughnessy 2020-01-09 15:33:52 -05:00
parent ed9b584344
commit 01aba1fcc4
29 changed files with 466 additions and 556 deletions

View file

@ -18848,7 +18848,7 @@
"testharness"
],
"mozilla/event_dispatch_order.html": [
"48513cfff42b8635eb8822a903e7e85250a7ac51",
"172ae368c707e695fc334df491d62c44dfb81566",
"testharness"
],
"mozilla/event_handler_syntax_error.html": [

View file

@ -1,5 +1,6 @@
<html>
<head>
<title>Even in the AT_TARGET phase, capture handlers fire before bubble handlers.</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
@ -7,25 +8,33 @@
<div id="foo"></div>
<script>
test(function() {
var sawBubble = false;
var sawCapture = false;
var sawBubbleTwice = false;
function handler(ev) {
// Added first, but it's a bubble so it shouldn't fire until
// after the capture.
assert_equals(ev.eventPhase, ev.AT_TARGET);
assert_equals(sawCapture, true);
assert_equals(sawBubble, false);
assert_equals(sawCapture, false);
assert_equals(sawBubbleTwice, false);
sawBubble = true;
}
function handler2(ev) {
// Capture: this should fire before both bubbles
assert_equals(ev.eventPhase, ev.AT_TARGET);
assert_equals(sawBubble, true);
assert_equals(sawCapture, false);
assert_equals(sawBubble, false);
assert_equals(sawBubbleTwice, false);
sawCapture = true;
}
function handler3(ev) {
// And this one fires last.
assert_equals(ev.eventPhase, ev.AT_TARGET);
assert_equals(sawBubble, true);
assert_equals(sawCapture, true);
assert_equals(sawBubble, true);
assert_equals(sawBubbleTwice, false);
sawBubbleTwice = true;
}