Files
sousa-gecko/testing/web-platform/tests/css/cssom-view/elementsFromPoint-inline-nested.html
T
Rune Lillesveen 19292fe30b Bug 2016739 [wpt PR 57779] - Make sure elementFromPoint() test hits span, a=testonly
Automatic update from web-platform-tests
Make sure elementFromPoint() test hits span

Fails in all browsers on Mac because the chosen point did not hit the
span text. Offset 8px:8px from top/left should.

Bug: 483394574
Change-Id: Iba275a6c0dff03239409c074da614414320dc37e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7572314
Reviewed-by: Steinar H Gunderson <sesse@chromium.org>
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1584629}

--

wpt-commits: 1283524c9ff984188025b32c3b6004634ebad443
wpt-pr: 57779
2026-02-18 09:32:50 +00:00

34 lines
1.2 KiB
HTML

<!DOCTYPE html>
<meta charset="utf-8">
<link rel="author" title="Miyoung Shin" href="myid.shin@igalia.com">
<link rel="author" title="Hyowon Kim" href="hyowon@igalia.com">
<link rel="help" href="https://www.w3.org/TR/cssom-view-1/#extensions-to-the-document-interface">
<div id="container" style="width:200px; height:200px;">
<span id="innerSpan2">
<span id="innerSpan3">
<span id="innerSpan4">This is in nested inline elements</span>
</span>
</span>
</div>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
test(() => {
const span = document.getElementById("innerSpan4");
const rect = span.getBoundingClientRect();
const x = rect.left + 8;
const y = rect.top + 8;
const elements = document.elementsFromPoint(x, y);
assert_equals(elements.length, 6);
assert_equals(elements[0].id, "innerSpan4");
assert_equals(elements[1].id, "innerSpan3");
assert_equals(elements[2].id, "innerSpan2");
assert_equals(elements[3].id, "container");
assert_equals(elements[4].nodeName, "BODY");
assert_equals(elements[5].nodeName, "HTML");
}, "elementsFromPoint should return all elements under a point, including nested inline elements");
</script>