OLD | NEW |
1 <script> | 1 <script> |
2 function test() { | 2 function test() { |
3 if (window.testRunner) | 3 if (window.testRunner) |
4 testRunner.dumpAsText(); | 4 testRunner.dumpAsText(); |
5 var style = document.defaultView.getComputedStyle(document.getElementById("t
est"), ""); | |
6 var result = document.getElementById("result"); | 5 var result = document.getElementById("result"); |
| 6 |
| 7 var style = document.defaultView.getComputedStyle(document.getElementById("t
est1"), ""); |
| 8 testStyle("Without not height", style, result); |
| 9 var style = document.defaultView.getComputedStyle(document.getElementById("t
est2"), ""); |
| 10 testStyle("Without height:100%;", style, result); |
| 11 var style = document.defaultView.getComputedStyle(document.getElementById("t
est3"), ""); |
| 12 testStyle("Without height:auto;", style, result); |
| 13 } |
| 14 |
| 15 function testStyle(name, style, result) { |
| 16 result.appendChild(document.createTextNode(name)); |
| 17 result.appendChild(document.createElement('br')); |
| 18 |
7 if (style.top == "-1px") | 19 if (style.top == "-1px") |
8 result.appendChild(document.createTextNode("Test succeeded! Top is " + s
tyle.top + ".")); | 20 result.appendChild(document.createTextNode("Test succeeded! top is " + s
tyle.top + ".")); |
9 else | 21 else |
10 result.appendChild(document.createTextNode("Test failed! Top is " + styl
e.top + ".")); | 22 result.appendChild(document.createTextNode("Test failed! top is " + styl
e.top + ".")); |
| 23 |
| 24 result.appendChild(document.createElement('br')); |
| 25 |
| 26 if (style.left == "-2px") |
| 27 result.appendChild(document.createTextNode("Test succeeded! left is " +
style.left + ".")); |
| 28 else |
| 29 result.appendChild(document.createTextNode("Test failed! left is " + sty
le.left + ".")); |
| 30 |
| 31 result.appendChild(document.createElement('br')); |
| 32 |
| 33 if (style.bottom == "1px") |
| 34 result.appendChild(document.createTextNode("Test succeeded! bottom is "
+ style.bottom + ".")); |
| 35 else |
| 36 result.appendChild(document.createTextNode("Test failed! bottom is " + s
tyle.bottom + ".")); |
| 37 |
| 38 result.appendChild(document.createElement('br')); |
| 39 |
| 40 if (style.right == "2px") |
| 41 result.appendChild(document.createTextNode("Test succeeded! right is " +
style.right + ".")); |
| 42 else |
| 43 result.appendChild(document.createTextNode("Test failed! right is " + st
yle.right + ".")); |
| 44 |
| 45 result.appendChild(document.createElement('br')); |
| 46 result.appendChild(document.createTextNode(style.width + " * " + style.heigh
t)); |
| 47 result.appendChild(document.createElement('br')); |
| 48 result.appendChild(document.createElement('br')); |
11 } | 49 } |
12 </script> | 50 </script> |
13 <body onload="test()"> | 51 <body onload="test()"> |
14 <div id="test" style="position:relative; top:-1px"></div> | 52 <div id="testContainer1" style="width: 100px; height: 200px;"> |
| 53 <div id="test1" style="position:relative; top:-1px; left:-2px;"></div> |
| 54 </div> |
| 55 <div id="testContainer2" style="width: 100px; height: 200px;"> |
| 56 <div id="test2" style="position:relative; top:-1px; left:-2px; height:100%;"></d
iv> |
| 57 </div> |
| 58 <div id="testContainer3" style="width: 100px; height: 200px;"> |
| 59 <div id="test3" style="position:relative; top:-1px; left:-2px; height:auto;"></d
iv> |
| 60 </div> |
15 <div id="result"></div> | 61 <div id="result"></div> |
16 </body> | 62 </body> |
OLD | NEW |