htmlelement-offset-width-001.html (1465B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>CSSOM View - 7 - element.offsetWidth detatches correctly</title> 5 <link rel="author" title="Michael Howell" href="mailto:michael@notriddle.com"> 6 <link rel="help" href="https://drafts.csswg.org/cssom-view-1/#dom-htmlelement-offsetwidth"> 7 <meta name="flags" content="dom"> 8 <meta name="assert" content="element.offsetWidth returns 0 when there is no documentElement."> 9 <script src="/resources/testharness.js"></script> 10 <script src="/resources/testharnessreport.js"></script> 11 </head> 12 <body> 13 <div id="myDiv">...</div> 14 <div id="log"></div> 15 <script> 16 test(function() { 17 // These asserts need to be in this order to trigger a bug in Servo. 18 var el = document.createElement("div"); 19 el.appendChild(document.createTextNode("...")); 20 assert_equals(el.offsetWidth, 0, "new element has offset width not equal to zero"); 21 assert_not_equals(document.getElementById("myDiv"), 0, "element with content has offset width equal to zero"); 22 var html = document.removeChild(document.documentElement); 23 // Put back the root element, so that testharnessreport.js can append the result. 24 this.add_cleanup(function() { document.appendChild(html); }); 25 assert_equals(el.offsetWidth, 0, "new element has offset width not equal to zero after removing documentElement"); 26 }); 27 </script> 28 </body> 29 </html>