CaretPosition-001.html (1221B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>CSSOM View Module test:CaretPosition</title> 5 <link rel="author" title="unbug" href="mailto:tidelgl@gmail.com" /> 6 <link rel="help" href="https://drafts.csswg.org/cssom-view-1/#dom-document-elementfrompoint"> 7 <script src="/resources/testharness.js"></script> 8 <script src="/resources/testharnessreport.js"></script> 9 <style type="text/css"> 10 .box{ 11 position: absolute; 12 top : 100px; 13 left : 400px; 14 width: 100px; 15 height: 100px; 16 background-color: #000; 17 } 18 </style> 19 </head> 20 <body> 21 <div id="box" class="box"></div> 22 <div class="box"></div> 23 <div class="box"></div> 24 <div class="box"></div> 25 <div class="box"></div> 26 <div class="box"></div> 27 <div id="box2" class="box"></div> 28 <div id="box3" class="box" style="left: 405px;background:red;"></div> 29 <div id="log"></div> 30 <script> 31 test(function(){ 32 assert_equals(document.elementFromPoint(400, 100), 33 document.getElementById('box2'), 34 "Expected value for element id is 'box2'"); 35 }, 'Element at (400, 100)'); 36 37 test(function(){ 38 assert_equals(document.elementFromPoint(400, 900), 39 null, 40 "Expected value for element id is 'box2'"); 41 }, 'Element at (400, 900)'); 42 </script> 43 </body> 44 </html>