|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <!-- |
|
4 https://bugzilla.mozilla.org/show_bug.cgi?id=657143 |
|
5 --> |
|
6 <head> |
|
7 <title>Test for Bug 657143</title> |
|
8 <script type="text/javascript" src="/MochiKit/MochiKit.js"></script> |
|
9 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
|
11 </head> |
|
12 <body> |
|
13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=657143">Mozilla Bug 657143</a> |
|
14 <p id="display"></p> |
|
15 <div id="content" style="display: none"> |
|
16 |
|
17 </div> |
|
18 <pre id="test"> |
|
19 <script class="testbody" type="text/javascript"> |
|
20 |
|
21 /** Test for Bug 657143 **/ |
|
22 |
|
23 // Checks ordering of CSS properties in nsComputedDOMStyle.cpp |
|
24 // by splitting the getComputedStyle() into the three sublists |
|
25 // then cloning and sort()ing the lists and comparing with originals |
|
26 |
|
27 var styleList = window.getComputedStyle(document.documentElement); |
|
28 cssA = [], mozA = [], svgA = [], mozList = false, |
|
29 svgList = false, noMozInSVG = true; |
|
30 // Need to split into sublists to compare |
|
31 for (var i = 0, j = styleList.length; i < j; i++) { |
|
32 var prop = styleList.item(i); |
|
33 // Check for start of -moz- list |
|
34 if (!mozList && /^-moz-/.test(prop)) { |
|
35 // Make sure no -moz- in the SVG list |
|
36 if (!svgList) { |
|
37 mozList = true; |
|
38 } else { |
|
39 noMozInSVG = false; |
|
40 // Don't add to svgA so can still test SVG order |
|
41 continue; |
|
42 } |
|
43 } |
|
44 // Add properties to the three lists |
|
45 if (mozList) { |
|
46 // Check for start of SVG list |
|
47 // Will break if any SVG props added before, unlikely though? |
|
48 if (prop == 'clip-path') { |
|
49 svgList = true; |
|
50 mozList = false; |
|
51 svgA.push(prop); |
|
52 } else { |
|
53 mozA.push(prop); |
|
54 } |
|
55 } else if (svgList) { |
|
56 svgA.push(prop); |
|
57 } else { |
|
58 cssA.push(prop); |
|
59 } |
|
60 } |
|
61 var cssB = cssA.slice(0), |
|
62 mozB = mozA.slice(0), |
|
63 svgB = svgA.slice(0); |
|
64 cssB.sort(); |
|
65 mozB.sort(); |
|
66 svgB.sort(); |
|
67 is(cssA.toString(), cssB.toString(), 'CSS property list should be alphabetical'); |
|
68 is(mozA.toString(), mozB.toString(), 'Experimental -moz- CSS property list should be alphabetical and not contain mature properties'); |
|
69 is(svgA.toString(), svgB.toString(), 'SVG property list should be alphabetical'); |
|
70 ok(noMozInSVG, 'Experimental -moz- CSS properties should not be in the SVG property list'); |
|
71 |
|
72 </script> |
|
73 </pre> |
|
74 </body> |
|
75 </html> |