xref: /third_party/node/test/fixtures/wpt/dom/events/Event-dispatch-other-document.html
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/fixtures/wpt/dom/events/
11cb0ef41Sopenharmony_ci<!doctype html>
21cb0ef41Sopenharmony_ci<title>Custom event on an element in another document</title>
31cb0ef41Sopenharmony_ci<script src="/resources/testharness.js"></script>
41cb0ef41Sopenharmony_ci<script src="/resources/testharnessreport.js"></script>
51cb0ef41Sopenharmony_ci<div id=log></div>
61cb0ef41Sopenharmony_ci<script>
71cb0ef41Sopenharmony_citest(function() {
81cb0ef41Sopenharmony_ci  var doc = document.implementation.createHTMLDocument("Demo");
91cb0ef41Sopenharmony_ci  var element = doc.createElement("div");
101cb0ef41Sopenharmony_ci  var called = false;
111cb0ef41Sopenharmony_ci  element.addEventListener("foo", this.step_func(function(ev) {
121cb0ef41Sopenharmony_ci    assert_false(called);
131cb0ef41Sopenharmony_ci    called = true;
141cb0ef41Sopenharmony_ci    assert_equals(ev.target, element);
151cb0ef41Sopenharmony_ci    assert_equals(ev.srcElement, element);
161cb0ef41Sopenharmony_ci  }));
171cb0ef41Sopenharmony_ci  doc.body.appendChild(element);
181cb0ef41Sopenharmony_ci
191cb0ef41Sopenharmony_ci  var event = new Event("foo");
201cb0ef41Sopenharmony_ci  element.dispatchEvent(event);
211cb0ef41Sopenharmony_ci  assert_true(called);
221cb0ef41Sopenharmony_ci});
231cb0ef41Sopenharmony_ci</script>
24

Indexes created Thu Nov 07 10:32:03 CST 2024