| <DOCTYPE html> |
| <html> |
| <body> |
| <script src="../../resources/js-test-pre.js"></script> |
| <script> |
| description("Test that it is possible to dispatchEvent() works on documents created using DOMParser.parseFromString()."); |
| |
| var wasEventDispatched = false; |
| var documentString = '<?xml version="1.0" encoding="UTF-8"?>\ |
| <root>\ |
| <foo>bar</foo>\ |
| </root>'; |
| var parser = new DOMParser(); |
| var parsedDocument = parser.parseFromString(documentString, 'text/xml'); |
| parsedDocument.addEventListener("click", function(evt) { |
| shouldBeFalse("wasEventDispatched"); |
| wasEventDispatched = true; |
| }, true); |
| var clickEvent = parsedDocument.createEvent("Event"); |
| clickEvent.initEvent("click", true, true); |
| parsedDocument.getElementsByTagName("foo")[0].dispatchEvent(clickEvent); |
| shouldBeTrue("wasEventDispatched"); |
| </script> |
| <script src="../../resources/js-test-post.js"></script> |
| </body> |
| </html> |