| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE html> | |
| 2 <script src="../resources/testharness.js"></script> | |
| 3 <script src="../resources/testharnessreport.js"></script> | |
| 4 <script src="resources/shadow-dom.js"></script> | |
| 5 | |
| 6 <input id="input"></input> | |
| 7 <div id="sandbox"> | |
| 8 <div id = "host"> | |
| 9 <template> | |
| 10 <input id="target" value="test"></div> | |
| 11 </template> | |
| 12 </div> | |
| 13 </div> | |
| 14 | |
| 15 <script> | |
| 16 var e; | |
| 17 test(function() { | |
| 18 e = new Event('test'); | |
| 19 assert_equals(e.composed, false); | |
| 20 }, 'A new events composed value should be set to false by default.'); | |
| 21 | |
| 22 test(function() { | |
| 23 e = new Event('test', { composed: true }); | |
| 24 assert_equals(e.composed, true); | |
| 25 }, 'Users should be able to set a composed value.'); | |
| 26 | |
| 27 var input = document.getElementById('input'); | |
| 28 async_test(function(t) { | |
| 29 input.onselect = function(e) { | |
| 30 t.step(function() { assert_false(e.composed); t.done(); }); | |
| 31 }; | |
| 32 }, 'UA select events composed should be set to false.'); | |
| 33 input.select(); | |
| 34 | |
| 35 var sandbox = document.getElementById('sandbox'); | |
| 36 convertTemplatesToShadowRootsWithin(sandbox); | |
| 37 var target = getNodeInComposedTree('host/target'); | |
| 38 var host = getNodeInComposedTree('host'); | |
| 39 | |
| 40 async_test(function(t) { | |
| 41 target.onselect = function(e) { | |
| 42 t.step(function() { | |
| 43 assert_true(e.composedPath().includes(target)); | |
| 44 assert_false(e.composedPath().includes(host)); | |
| 45 t.done(); | |
| 46 }); | |
| 47 } | |
| 48 }, 'Select events should stop if created by UA.'); | |
| 49 | |
| 50 async_test(function(t) { | |
| 51 target.onerror = function(e) { | |
| 52 t.step(function() { | |
| 53 assert_true(e.composedPath().includes(target)); | |
| 54 assert_true(e.composedPath().includes(host)); | |
| 55 t.done(); | |
| 56 }); | |
| 57 } | |
| 58 }, 'Only certain trusted events should stop in bubbling.'); | |
| 59 | |
| 60 target.select(); | |
| 61 var userError = new Event('error'); | |
| 62 target.dispatchEvent(userError); | |
| 63 </script> | |
| OLD | NEW |