client-props-input.html (1815B)
1 <!doctype html> 2 <title>client* on input / textarea</title> 3 <link rel="help" href="https://drafts.csswg.org/cssom-view/#extension-to-the-element-interface"> 4 <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1654769"> 5 <link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io"> 6 <link rel="author" title="Mozilla" href="https://mozilla.org"> 7 <script src=/resources/testharness.js></script> 8 <script src=/resources/testharnessreport.js></script> 9 <style> 10 input, textarea { 11 -webkit-appearance: none; 12 appearance: none; 13 height: 200px; 14 width: 300px; 15 border-style: solid; 16 border-width: 10px 20px; 17 padding: 2px; 18 box-sizing: content-box; 19 } 20 .block { display: block; } 21 </style> 22 <input> 23 <textarea></textarea> 24 <input class="block"> 25 <textarea class="block"></textarea> 26 <script> 27 test(() => { 28 for (let element of document.querySelectorAll("input, textarea")) { 29 let description = `${element.nodeName} ${element.className}: `; 30 assert_equals(element.clientHeight, 204, description + "clientHeight should be the padding box height"); 31 assert_equals(element.clientTop, 10, description + "clientTop should include the border offset"); 32 // <input> clips to the content box edge in the inline axis, so it should also include the padding offset. 33 let expectedLeft = 20; 34 let expectedWidth = 304; 35 if (element.nodeName == "INPUT") { 36 expectedLeft += 2; 37 expectedWidth -= 4; 38 } 39 assert_equals(element.clientWidth, expectedWidth, description + "clientWidth should be the padding box for textarea, content box for input"); 40 assert_equals(element.clientLeft, expectedLeft, description + "clientLeft should include the border offset for textarea and border + padding for input"); 41 } 42 }, "client* on input / textarea"); 43 </script>