OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <meta charset=utf-8> |
| 3 <title> Event.bubbles attribute is set to false </title> |
| 4 <link rel="help" href="https://dom.spec.whatwg.org/#dom-event-initevent"> |
| 5 <link rel="help" href="https://dom.spec.whatwg.org/#concept-event-dispatch"> |
| 6 <script src="../../../../resources/testharness.js"></script> |
| 7 <script src="../../../../resources/testharnessreport.js"></script> |
| 8 <div id=log></div> |
| 9 <table id="table" border="1" style="display: none"> |
| 10 <tbody id="table-body"> |
| 11 <tr id="table-row"> |
| 12 <td id="table-cell">Shady Grove</td> |
| 13 <td>Aeolian</td> |
| 14 </tr> |
| 15 <tr id="parent"> |
| 16 <td id="target">Over the river, Charlie</td> |
| 17 <td>Dorian</td> |
| 18 </tr> |
| 19 </tbody> |
| 20 </table> |
| 21 <script> |
| 22 test(function() { |
| 23 var event_type = "click"; |
| 24 var target = document.getElementById("target"); |
| 25 var targets = [ |
| 26 window, |
| 27 document, |
| 28 document.documentElement, |
| 29 document.body, |
| 30 document.getElementById("table"), |
| 31 document.getElementById("table-body"), |
| 32 document.getElementById("parent"), |
| 33 target, |
| 34 ]; |
| 35 var expected_targets = targets.concat(target); |
| 36 var phases = [ |
| 37 Event.CAPTURING_PHASE, |
| 38 Event.CAPTURING_PHASE, |
| 39 Event.CAPTURING_PHASE, |
| 40 Event.CAPTURING_PHASE, |
| 41 Event.CAPTURING_PHASE, |
| 42 Event.CAPTURING_PHASE, |
| 43 Event.CAPTURING_PHASE, |
| 44 Event.AT_TARGET, |
| 45 Event.AT_TARGET, |
| 46 ]; |
| 47 |
| 48 |
| 49 var actual_targets = [], actual_phases = []; |
| 50 var test_event = function(evt) { |
| 51 actual_targets.push(evt.currentTarget); |
| 52 actual_phases.push(evt.eventPhase); |
| 53 } |
| 54 |
| 55 for (var i = 0; i < targets.length; i++) { |
| 56 targets[i].addEventListener(event_type, test_event, true); |
| 57 targets[i].addEventListener(event_type, test_event, false); |
| 58 } |
| 59 |
| 60 var evt = document.createEvent("Event"); |
| 61 evt.initEvent(event_type, false, true); |
| 62 |
| 63 target.dispatchEvent(evt); |
| 64 |
| 65 assert_array_equals(actual_targets, expected_targets, "targets"); |
| 66 assert_array_equals(actual_phases, phases, "phases"); |
| 67 }, "Event.dispatchEvent with Event.bubbles set to false."); |
| 68 </script> |
OLD | NEW |