11cb0ef41Sopenharmony_ci<!DOCTYPE html> 21cb0ef41Sopenharmony_ci<meta charset=utf-8> 31cb0ef41Sopenharmony_ci<title>EventTarget.addEventListener: capture argument omitted</title> 41cb0ef41Sopenharmony_ci<link rel="help" href="https://dom.spec.whatwg.org/#dom-eventtarget-addeventlistener"> 51cb0ef41Sopenharmony_ci<link rel="help" href="https://dom.spec.whatwg.org/#concept-event-dispatch"> 61cb0ef41Sopenharmony_ci<script src="/resources/testharness.js"></script> 71cb0ef41Sopenharmony_ci<script src="/resources/testharnessreport.js"></script> 81cb0ef41Sopenharmony_ci<div id=log></div> 91cb0ef41Sopenharmony_ci<table id="table" border="1" style="display: none"> 101cb0ef41Sopenharmony_ci <tbody id="table-body"> 111cb0ef41Sopenharmony_ci <tr id="table-row"> 121cb0ef41Sopenharmony_ci <td id="table-cell">Shady Grove</td> 131cb0ef41Sopenharmony_ci <td>Aeolian</td> 141cb0ef41Sopenharmony_ci </tr> 151cb0ef41Sopenharmony_ci <tr id="parent"> 161cb0ef41Sopenharmony_ci <td id="target">Over the river, Charlie</td> 171cb0ef41Sopenharmony_ci <td>Dorian</td> 181cb0ef41Sopenharmony_ci </tr> 191cb0ef41Sopenharmony_ci </tbody> 201cb0ef41Sopenharmony_ci</table> 211cb0ef41Sopenharmony_ci<script> 221cb0ef41Sopenharmony_citest(function() { 231cb0ef41Sopenharmony_ci var event_type = "foo"; 241cb0ef41Sopenharmony_ci var target = document.getElementById("target"); 251cb0ef41Sopenharmony_ci var targets = [ 261cb0ef41Sopenharmony_ci target, 271cb0ef41Sopenharmony_ci document.getElementById("parent"), 281cb0ef41Sopenharmony_ci document.getElementById("table-body"), 291cb0ef41Sopenharmony_ci document.getElementById("table"), 301cb0ef41Sopenharmony_ci document.body, 311cb0ef41Sopenharmony_ci document.documentElement, 321cb0ef41Sopenharmony_ci document, 331cb0ef41Sopenharmony_ci window 341cb0ef41Sopenharmony_ci ]; 351cb0ef41Sopenharmony_ci var phases = [ 361cb0ef41Sopenharmony_ci Event.AT_TARGET, 371cb0ef41Sopenharmony_ci Event.BUBBLING_PHASE, 381cb0ef41Sopenharmony_ci Event.BUBBLING_PHASE, 391cb0ef41Sopenharmony_ci Event.BUBBLING_PHASE, 401cb0ef41Sopenharmony_ci Event.BUBBLING_PHASE, 411cb0ef41Sopenharmony_ci Event.BUBBLING_PHASE, 421cb0ef41Sopenharmony_ci Event.BUBBLING_PHASE, 431cb0ef41Sopenharmony_ci Event.BUBBLING_PHASE 441cb0ef41Sopenharmony_ci ]; 451cb0ef41Sopenharmony_ci 461cb0ef41Sopenharmony_ci var actual_targets = [], actual_phases = []; 471cb0ef41Sopenharmony_ci var test_event = function(evt) { 481cb0ef41Sopenharmony_ci actual_targets.push(evt.currentTarget); 491cb0ef41Sopenharmony_ci actual_phases.push(evt.eventPhase); 501cb0ef41Sopenharmony_ci } 511cb0ef41Sopenharmony_ci 521cb0ef41Sopenharmony_ci for (var i = 0; i < targets.length; i++) { 531cb0ef41Sopenharmony_ci targets[i].addEventListener(event_type, test_event); 541cb0ef41Sopenharmony_ci } 551cb0ef41Sopenharmony_ci 561cb0ef41Sopenharmony_ci var evt = document.createEvent("Event"); 571cb0ef41Sopenharmony_ci evt.initEvent(event_type, true, true); 581cb0ef41Sopenharmony_ci 591cb0ef41Sopenharmony_ci target.dispatchEvent(evt); 601cb0ef41Sopenharmony_ci 611cb0ef41Sopenharmony_ci for (var i = 0; i < targets.length; i++) { 621cb0ef41Sopenharmony_ci targets[i].removeEventListener(event_type, test_event); 631cb0ef41Sopenharmony_ci } 641cb0ef41Sopenharmony_ci 651cb0ef41Sopenharmony_ci target.dispatchEvent(evt); 661cb0ef41Sopenharmony_ci 671cb0ef41Sopenharmony_ci assert_array_equals(actual_targets, targets, "targets"); 681cb0ef41Sopenharmony_ci assert_array_equals(actual_phases, phases, "phases"); 691cb0ef41Sopenharmony_ci}, "EventTarget.addEventListener with the capture argument omitted"); 701cb0ef41Sopenharmony_ci</script> 71