elementFromPoint-mixed-font-sizes.html (901B)
1 <!DOCTYPE html> 2 <link rel="help" href="http://www.w3.org/TR/cssom-view/#extensions-to-the-document-interface"> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <div style="font-size: 40px"> 6 <span id="target"> 7 XXX <span id="small" style="font-size:10px">small</span> YYY 8 </span> 9 </div> 10 <script> 11 test(() => { 12 // Find a point in the empty region above the "small" span, but still inside 13 // the "target" span. 14 const small = document.getElementById('small'); 15 const rect = small.getBoundingClientRect(); 16 const x = rect.left + rect.width / 2; 17 const y = rect.top - 5; 18 19 const actual = document.elementFromPoint(x, y); 20 const target = document.getElementById('target'); 21 assert_equals(actual, target); 22 }, 'document.elementFromPoint finds container SPAN in the empty region above a child SPAN with a smaller font size'); 23 </script>