OLD | NEW |
1 <?xml version="1.0" encoding="UTF-8"?> | 1 <?xml version="1.0" encoding="UTF-8"?> |
2 <html xmlns="http://www.w3.org/1999/xhtml"> | 2 <html xmlns="http://www.w3.org/1999/xhtml"> |
3 <head> | 3 <head> |
4 </head> | 4 </head> |
5 <body onload="startTest()"> | 5 <body onload="startTest()"> |
6 | 6 |
7 <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlin
k" width="100px" height="100px"> | 7 <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlin
k" width="100px" height="100px"> |
8 <defs> | 8 <defs> |
9 <rect id="target" fill="green" width="100" height="100"/> | 9 <rect id="target" fill="green" width="100" height="100"/> |
10 </defs> | 10 </defs> |
(...skipping 20 matching lines...) Expand all Loading... |
31 function fireSimulatedMouseClickEvent(eventTarget) | 31 function fireSimulatedMouseClickEvent(eventTarget) |
32 { | 32 { |
33 var event = document.createEvent("MouseEvents"); | 33 var event = document.createEvent("MouseEvents"); |
34 event.initMouseEvent("click", true, true, document.defaultView, 1, 0, 0, 0,
0, false, false, false, false, 0, null); | 34 event.initMouseEvent("click", true, true, document.defaultView, 1, 0, 0, 0,
0, false, false, false, false, 0, null); |
35 eventTarget.dispatchEvent(event); | 35 eventTarget.dispatchEvent(event); |
36 } | 36 } |
37 | 37 |
38 function startTest() { | 38 function startTest() { |
39 var useElement = document.getElementById("test"); | 39 var useElement = document.getElementById("test"); |
40 | 40 |
| 41 var shadowRoot = internals.shadowRoot(useElement); |
| 42 |
41 // No-op, as no listener is not yet registered | 43 // No-op, as no listener is not yet registered |
42 fireSimulatedMouseClickEvent(useElement.instanceRoot); | 44 fireSimulatedMouseClickEvent(shadowRoot.firstChild); |
43 | 45 |
44 // Add listener | 46 // Add listener |
45 useElement.instanceRoot.addEventListener("click", eventHandler, false); | 47 shadowRoot.firstChild.addEventListener("click", eventHandler, false); |
46 | 48 |
47 // Should fire immediately and finish the test | 49 // Should fire immediately and finish the test |
48 fireSimulatedMouseClickEvent(useElement.instanceRoot); | 50 fireSimulatedMouseClickEvent(shadowRoot.firstChild); |
49 } | 51 } |
50 </script> | 52 </script> |
51 | 53 |
52 </body> | 54 </body> |
53 </html> | 55 </html> |
OLD | NEW |