negativeMargins.html (1219B)
1 <!DOCTYPE html> 2 <meta charset=utf-8> 3 <title>cssom-view - elementFromPoint and elementsFromPoint dealing with negative margins</title> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <body> 7 <div id="outer" style="background:yellow"> 8 <div id="inner" style="width:100px; height:100px; margin-bottom:-100px; background:lime;"></div> 9 Hello 10 </div> 11 <script> 12 window.onload = function () { 13 var outer = document.getElementById('outer'); 14 var inner = document.getElementById('inner'); 15 var outerRect = outer.getBoundingClientRect(); 16 test(function () { 17 assert_equals(document.elementFromPoint(outerRect.left + 1, 18 outerRect.top + 1), 19 outer, 20 "elementFromPoint should get outer element"); 21 }); 22 test(function () { 23 assert_array_equals(document.elementsFromPoint(outerRect.left + 1, 24 outerRect.top + 1), 25 [inner, outer, document.body, document.querySelector('html')], 26 "elementsFromPoint should get sequence [inner, outer, body, html]"); 27 }); 28 }; 29 </script> 30 </body>