Revision 105aa9b5f1a2cd3ab4f2d4cbf9db2cd9a0c7bd39 authored by jgraham on 28 March 2018, 19:03:58 UTC, committed by GitHub on 28 March 2018, 19:03:58 UTC
1 parent 167a1d6
Raw File
Event-dispatch-other-document.html
<!doctype html>
<title>Custom event on an element in another document</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id=log></div>
<script>
test(function() {
  var doc = document.implementation.createHTMLDocument("Demo");
  var element = doc.createElement("div");
  var called = false;
  element.addEventListener("foo", this.step_func(function(ev) {
    assert_false(called);
    called = true;
    assert_equals(ev.target, element);
  }));
  doc.body.appendChild(element);

  var event = new Event("foo");
  element.dispatchEvent(event);
  assert_true(called);
});
</script>
back to top