| <DOCTYPE html> |
| <html> |
| <body> |
| <script src="../../resources/js-test-pre.js"></script> |
| <template id="t"></template> |
| <script> |
| description("Test that it is possible to dispatchEvent() works on template documents."); |
| |
| var wasEventDispatched = false; |
| let doc = document.implementation.createDocument('', ''); |
| let tXml = doc.importNode(t); |
| |
| tXml.content.ownerDocument.addEventListener("click", function(evt) { |
| shouldBeFalse("wasEventDispatched"); |
| wasEventDispatched = true; |
| }, true); |
| var clickEvent = tXml.content.ownerDocument.createEvent("Event"); |
| clickEvent.initEvent("click", true, true); |
| tXml.content.ownerDocument.dispatchEvent(clickEvent); |
| shouldBeTrue("wasEventDispatched"); |
| </script> |
| <script src="../../resources/js-test-post.js"></script> |
| </body> |
| </html> |