Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /css/cssom-view/elementFromPoint-mixed-font-sizes.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div style="font-size: 40px">
<span id="target">
XXX <span id="small" style="font-size:10px">small</span> YYY
</span>
</div>
<script>
test(() => {
// Find a point in the empty region above the "small" span, but still inside
// the "target" span.
const small = document.getElementById('small');
const rect = small.getBoundingClientRect();
const x = rect.left + rect.width / 2;
const y = rect.top - 5;
const actual = document.elementFromPoint(x, y);
const target = document.getElementById('target');
assert_equals(actual, target);
}, 'document.elementFromPoint finds container SPAN in the empty region above a child SPAN with a smaller font size');
</script>