|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <!-- |
|
4 https://bugzilla.mozilla.org/show_bug.cgi?id=678671 |
|
5 --> |
|
6 <head> |
|
7 <title>Test for Bug 678671</title> |
|
8 <script type="application/javascript" src="/MochiKit/packed.js"></script> |
|
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=678671">Mozilla Bug 678671</a> |
|
15 <p id="display"></p> |
|
16 <div id="content"></div> |
|
17 <script type="application/javascript"> |
|
18 |
|
19 /** Test for Bug 678671 **/ |
|
20 |
|
21 /** |
|
22 * Test 'ex' and 'ch' units in every place we possible can to make |
|
23 * sure they don't cause an infinite loop. |
|
24 */ |
|
25 |
|
26 var content = document.getElementById("content"); |
|
27 var cs = getComputedStyle(content, ""); |
|
28 |
|
29 for (var prop in gCSSProperties) { |
|
30 var info = gCSSProperties[prop]; |
|
31 if (info.backend_only) { |
|
32 continue; |
|
33 } |
|
34 function test_val(v) { |
|
35 content.style.setProperty(prop, v, ""); |
|
36 isnot(get_computed_value(cs, prop), "", |
|
37 "Setting '" + prop + "' to '" + v + "' should not cause infinite loop"); |
|
38 } |
|
39 test_val('3ex'); |
|
40 test_val('2ch'); |
|
41 function test_replaced_values(value_list) { |
|
42 // For each item in value_list, if it looks like it has a dimension |
|
43 // in it, replace those dimensions with 3ex and 2ch and test it. |
|
44 for (var i = 0; i < value_list.length; ++i) { |
|
45 var value = value_list[i]; |
|
46 function try_replace(withval) { |
|
47 var rep = value.replace(/[0-9.]+[a-zA-Z]+/g, withval) |
|
48 if (rep != value) { |
|
49 test_val(rep); |
|
50 } |
|
51 } |
|
52 try_replace('3ex'); |
|
53 try_replace('2ch'); |
|
54 } |
|
55 } |
|
56 test_replaced_values(info.initial_values); |
|
57 test_replaced_values(info.other_values); |
|
58 content.style.removeProperty(prop); |
|
59 } |
|
60 |
|
61 </script> |
|
62 </pre> |
|
63 </body> |
|
64 </html> |