resize-background-ref.html (1019B)
1 <html> 2 <script> 3 function sizeResizer() { 4 // reference resizer 5 var img = document.getElementsByTagName("img")[0]; 6 // hidden textarea 7 var textarea = document.getElementsByTagName("textarea")[0]; 8 var width = 200 - textarea.clientWidth; 9 var height = 200 - textarea.clientHeight; 10 // (Leave test failing if a scrollbar is missing) 11 if (width != 0 && height != 0) { 12 img.style.width = width + "px"; 13 img.style.left = textarea.clientWidth + "px"; 14 img.style.height = height + "px"; 15 img.style.top = textarea.clientHeight + "px"; 16 } 17 } 18 </script> 19 <body onload="sizeResizer()"> 20 <textarea style="width: 200px; height: 200px; margin: 0; border: none; 21 background: red; font-size: 400px;"> 22 M 23 </textarea> 24 <div style="position: relative; top: -200px; 25 width: 200px; height: 200px; margin: 0; border: none; 26 background: lightgreen"> 27 <img style="position: relative;" src="chrome://global/skin/icons/resizer.svg"> 28 </div> 29 </body> 30 </html>