Skip to content

Commit

Permalink
DOM: listeners on target are now copied twice
Browse files Browse the repository at this point in the history
We changed event dispatch to have a "capturing" and "bubbling" phase. Each phase does AT_TARGET handling. Each phase also copies listeners. This means that listeners added during "capturing", now run during "bubbling", where they previously did not.

See whatwg/dom#746 for additional context.
  • Loading branch information
annevk committed Apr 11, 2019
1 parent 52fa7a1 commit 0fbaeb4
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions dom/events/Event-dispatch-handlers-changed.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</table>

<script>
async_test(function() {
test(function() {
var event_type = "bar";
var target = document.getElementById("target");
var parent = document.getElementById("parent");
Expand All @@ -39,6 +39,7 @@
parent,
target,
target,
target, // The additional listener for target runs as we copy its listeners twice
parent,
tbody,
table,
Expand All @@ -47,7 +48,7 @@
document,
window
];
var expected_listeners = [0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1];
var expected_listeners = [0,0,0,0,0,0,0,0,1,3,1,1,1,1,1,1,1];

var actual_targets = [], actual_listeners = [];
var test_event_function = function(i) {
Expand Down Expand Up @@ -86,7 +87,5 @@

assert_array_equals(actual_targets, expected_targets, "actual_targets");
assert_array_equals(actual_listeners, expected_listeners, "actual_listeners");

this.done();
});
</script>

0 comments on commit 0fbaeb4

Please sign in to comment.