1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/style/test/test_bug657143.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,75 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=657143 1.8 +--> 1.9 +<head> 1.10 + <title>Test for Bug 657143</title> 1.11 + <script type="text/javascript" src="/MochiKit/MochiKit.js"></script> 1.12 + <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.13 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 1.14 +</head> 1.15 +<body> 1.16 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=657143">Mozilla Bug 657143</a> 1.17 +<p id="display"></p> 1.18 +<div id="content" style="display: none"> 1.19 + 1.20 +</div> 1.21 +<pre id="test"> 1.22 +<script class="testbody" type="text/javascript"> 1.23 + 1.24 +/** Test for Bug 657143 **/ 1.25 + 1.26 +// Checks ordering of CSS properties in nsComputedDOMStyle.cpp 1.27 +// by splitting the getComputedStyle() into the three sublists 1.28 +// then cloning and sort()ing the lists and comparing with originals 1.29 + 1.30 +var styleList = window.getComputedStyle(document.documentElement); 1.31 + cssA = [], mozA = [], svgA = [], mozList = false, 1.32 + svgList = false, noMozInSVG = true; 1.33 +// Need to split into sublists to compare 1.34 +for (var i = 0, j = styleList.length; i < j; i++) { 1.35 + var prop = styleList.item(i); 1.36 + // Check for start of -moz- list 1.37 + if (!mozList && /^-moz-/.test(prop)) { 1.38 + // Make sure no -moz- in the SVG list 1.39 + if (!svgList) { 1.40 + mozList = true; 1.41 + } else { 1.42 + noMozInSVG = false; 1.43 + // Don't add to svgA so can still test SVG order 1.44 + continue; 1.45 + } 1.46 + } 1.47 + // Add properties to the three lists 1.48 + if (mozList) { 1.49 + // Check for start of SVG list 1.50 + // Will break if any SVG props added before, unlikely though? 1.51 + if (prop == 'clip-path') { 1.52 + svgList = true; 1.53 + mozList = false; 1.54 + svgA.push(prop); 1.55 + } else { 1.56 + mozA.push(prop); 1.57 + } 1.58 + } else if (svgList) { 1.59 + svgA.push(prop); 1.60 + } else { 1.61 + cssA.push(prop); 1.62 + } 1.63 +} 1.64 +var cssB = cssA.slice(0), 1.65 +mozB = mozA.slice(0), 1.66 +svgB = svgA.slice(0); 1.67 +cssB.sort(); 1.68 +mozB.sort(); 1.69 +svgB.sort(); 1.70 +is(cssA.toString(), cssB.toString(), 'CSS property list should be alphabetical'); 1.71 +is(mozA.toString(), mozB.toString(), 'Experimental -moz- CSS property list should be alphabetical and not contain mature properties'); 1.72 +is(svgA.toString(), svgB.toString(), 'SVG property list should be alphabetical'); 1.73 +ok(noMozInSVG, 'Experimental -moz- CSS properties should not be in the SVG property list'); 1.74 + 1.75 +</script> 1.76 +</pre> 1.77 +</body> 1.78 +</html>