blob: df9dc136c7e5b62c7a3d083cc8c17783ef783ffa [file] [log] [blame]
<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>