xref: /third_party/node/test/fixtures/wpt/dom/events/mouse-event-retarget.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<html>
31cb0ef41Sopenharmony_ci<title>Script created MouseEvent properly retargets and adjusts offsetX</title>
41cb0ef41Sopenharmony_ci<script src="/resources/testharness.js"></script>
51cb0ef41Sopenharmony_ci<script src="/resources/testharnessreport.js"></script>
61cb0ef41Sopenharmony_ci
71cb0ef41Sopenharmony_ci<style>
81cb0ef41Sopenharmony_cibody {
91cb0ef41Sopenharmony_ci  margin: 8px;
101cb0ef41Sopenharmony_ci  padding: 0;
111cb0ef41Sopenharmony_ci}
121cb0ef41Sopenharmony_ci</style>
131cb0ef41Sopenharmony_ci
141cb0ef41Sopenharmony_ci<div id="target">Hello</div>
151cb0ef41Sopenharmony_ci
161cb0ef41Sopenharmony_ci<script>
171cb0ef41Sopenharmony_ciasync_test(t => {
181cb0ef41Sopenharmony_ci  target.addEventListener('click', ev => {
191cb0ef41Sopenharmony_ci    t.step(() => assert_equals(ev.offsetX, 42));
201cb0ef41Sopenharmony_ci    t.done();
211cb0ef41Sopenharmony_ci  });
221cb0ef41Sopenharmony_ci
231cb0ef41Sopenharmony_ci  const ev = new MouseEvent('click', { clientX: 50 });
241cb0ef41Sopenharmony_ci  target.dispatchEvent(ev);
251cb0ef41Sopenharmony_ci}, "offsetX is correctly adjusted");
261cb0ef41Sopenharmony_ci</script>
27

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