content-visibility-089.html (1329B)
1 <!doctype HTML> 2 <html> 3 <meta charset="utf8"> 4 <title>Content Visibility: clientLeft/clientTop/clientWidth/clientHeight measure correctly</title> 5 <link rel="author" title="Rob Buis" href="mailto:rbuis@igalia.com"> 6 <link rel="help" href="https://drafts.csswg.org/css-contain/#content-visibility"> 7 <meta name="assert" content="clientLeft/clientTop/clientWidth/clientHeight measure correctly in content-visibility hidden subtree"> 8 9 <script src="/resources/testharness.js"></script> 10 <script src="/resources/testharnessreport.js"></script> 11 12 <style> 13 body { 14 margin: 0; 15 padding: 0; 16 } 17 #outer { 18 width: 100px; 19 height: 100px; 20 background: lightblue; 21 22 content-visibility: hidden; 23 } 24 #inner { 25 border-left: 25px black solid; 26 border-top: 25px black solid; 27 margin: 25px; 28 width: 50px; 29 height: 50px; 30 background: lightgreen; 31 } 32 </style> 33 34 <body> 35 <div id="outer"><div id="inner"></div></div> 36 </body> 37 38 <script> 39 test(() => { 40 const inner = document.getElementById("inner"); 41 42 inner.style.borderLeftWidth = "20px"; 43 assert_equals(inner.clientLeft, 20, "left"); 44 45 inner.style.borderTopWidth = "20px"; 46 assert_equals(inner.clientTop, 20, "top"); 47 48 inner.style.width = "40px"; 49 assert_equals(inner.clientWidth, 40, "width"); 50 51 inner.style.height = "40px"; 52 assert_equals(inner.clientHeight, 40, "height"); 53 }); 54 55 </script> 56 </html>