getBoundingClientRect-content-visibility-hidden.html (1217B)
1 <!DOCTYPE html> 2 <link rel="help" href="https://drafts.csswg.org/cssom-view/#dom-element-getboundingclientrect"> 3 <link rel="help" href="https://drafts.csswg.org/cssom-view/#dom-range-getboundingclientrect"> 4 <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1918733"> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <style> 8 </style> 9 <body> 10 <div style="content-visibility: hidden; contain-intrinsic-size: 100px 100px;"> 11 <span id="span">Hello</span> 12 </div> 13 <script> 14 const rangeLeaf = document.createRange(); 15 const rangeRoot = document.createRange(); 16 rangeLeaf.selectNode(span.firstChild); 17 rangeRoot.selectNode(document.documentElement); 18 const rectLeaf = rangeLeaf.getBoundingClientRect(); 19 const rectRoot = rangeRoot.getBoundingClientRect(); 20 test(() => assert_not_equals(rectLeaf.width, 0, "leaf rect width should not be zero")); 21 test(() => assert_not_equals(rectLeaf.height, 0, "leaf rect height should not be zero")); 22 test(() => assert_not_equals(rectRoot.width, 0, "root rect width should not be zero")); 23 test(() => assert_not_equals(rectRoot.height, 0, "root rect height should not be zero")); 24 </script> 25 </body>