|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <!-- |
|
4 https://bugzilla.mozilla.org/show_bug.cgi?id=969460 |
|
5 --> |
|
6 <head> |
|
7 <meta charset="utf-8"> |
|
8 <title>Test for Bug 969460</title> |
|
9 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
10 <script type="text/javascript" src="property_database.js"></script> |
|
11 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
|
12 </head> |
|
13 <body> |
|
14 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=969460">Mozilla Bug 969460</a> |
|
15 <p id="display"></p> |
|
16 <div id="content" style="display: none"> |
|
17 <div id="float" style="float: left"></div> |
|
18 </div> |
|
19 <pre id="test"> |
|
20 <script type="application/javascript"> |
|
21 |
|
22 /** Test for Bug 969460: Test that "display" on the root node is computed |
|
23 using the same conversion that we use for display on floated elements **/ |
|
24 |
|
25 function test_display_value(val) |
|
26 { |
|
27 var floatElem = document.getElementById("float"); |
|
28 floatElem.style.display = val; |
|
29 var floatConversion = window.getComputedStyle(floatElem, null).display; |
|
30 floatElem.style.display = ""; |
|
31 |
|
32 var rootNode = document.documentElement; |
|
33 rootNode.style.display = val; |
|
34 rootNode.offsetHeight; // (Flush layout, to be sure layout can handle 'val') |
|
35 var rootConversion = window.getComputedStyle(rootNode, null).display; |
|
36 rootNode.style.display = ""; |
|
37 |
|
38 // Special case: "display:list-item" does not get modified by 'float', |
|
39 // but the spec allows us to convert it to 'block' on the root node |
|
40 // (and we do convert it, so that we don't have to support documents whose |
|
41 // root node is a list-item). |
|
42 if (val == "list-item") { |
|
43 is(floatConversion, val, "'float' shouldn't affect 'display:list-item'"); |
|
44 is(rootConversion, "block", |
|
45 "We traditionally convert 'display:list-item' on the root node to " + |
|
46 "'display:block' (though if that changes, it's not technically a bug, " + |
|
47 "as long as we support it properly)."); |
|
48 } else { |
|
49 is(rootConversion, floatConversion, |
|
50 "root node should make 'display:" + val + "' compute to the same " + |
|
51 "value that it computes to on a floated element"); |
|
52 } |
|
53 } |
|
54 |
|
55 var displayInfo = gCSSProperties["display"]; |
|
56 displayInfo.initial_values.forEach(test_display_value); |
|
57 displayInfo.other_values.forEach(test_display_value); |
|
58 |
|
59 </script> |
|
60 </pre> |
|
61 </body> |
|
62 </html> |