layout/style/test/test_css_function_mismatched_parenthesis.html

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html>
michael@0 3 <!--
michael@0 4 https://bugzilla.mozilla.org/show_bug.cgi?id=897094
michael@0 5
michael@0 6 This test verifies that:
michael@0 7 (1) Mismatched parentheses in a CSS function prevent parsing of subsequent CSS
michael@0 8 properties.
michael@0 9 (2) Properly matched parentheses do not prevent parsing of subsequent CSS
michael@0 10 properties.
michael@0 11 -->
michael@0 12 <head>
michael@0 13 <title>Test for Bug 897094</title>
michael@0 14 <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
michael@0 15 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 16 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
michael@0 17 </head>
michael@0 18 <body>
michael@0 19 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=897094">Mozilla Bug 897094</a>
michael@0 20 <p id="display"></p>
michael@0 21 <div id="content" style="display: none">
michael@0 22 <div id="target"></div>
michael@0 23 </div>
michael@0 24 <pre id="test">
michael@0 25 <script class="testbody" type="text/javascript">
michael@0 26
michael@0 27 /** Test for Bug 897094 **/
michael@0 28 function check_parens(declaration, parens_are_balanced)
michael@0 29 {
michael@0 30 var element = document.getElementById("target");
michael@0 31 element.setAttribute("style",
michael@0 32 "background-color: " + (parens_are_balanced ? "red" : "green") + "; " +
michael@0 33 declaration + "; " +
michael@0 34 "background-color: " + (parens_are_balanced ? "green" : "red") + "; ");
michael@0 35 var resultColor = element.style.getPropertyValue("background-color");
michael@0 36 is(resultColor, "green", "parenthesis balancing within " + declaration);
michael@0 37 }
michael@0 38
michael@0 39 check_parens("transform: scale()", true);
michael@0 40 check_parens("transform: scale(", false);
michael@0 41 check_parens("transform: scale(,)", true);
michael@0 42 check_parens("transform: scale(,", false);
michael@0 43 check_parens("transform: scale(1)", true);
michael@0 44 check_parens("transform: scale(1", false);
michael@0 45 check_parens("transform: scale(1,)", true);
michael@0 46 check_parens("transform: scale(1,", false);
michael@0 47 check_parens("transform: scale(1,1)", true);
michael@0 48 check_parens("transform: scale(1,1", false);
michael@0 49 check_parens("transform: scale(1,1,)", true);
michael@0 50 check_parens("transform: scale(1,1,", false);
michael@0 51 check_parens("transform: scale(1,1,1)", true);
michael@0 52 check_parens("transform: scale(1,1,1", false);
michael@0 53 check_parens("transform: scale(1,1,1,)", true);
michael@0 54 check_parens("transform: scale(1,1,1,", false);
michael@0 55 check_parens("transform: scale(1px)", true);
michael@0 56 check_parens("transform: scale(1px", false);
michael@0 57 check_parens("transform: scale(1px,)", true);
michael@0 58 check_parens("transform: scale(1px,", false);
michael@0 59
michael@0 60 </script>
michael@0 61 </pre>
michael@0 62 </body>
michael@0 63 </html>

mercurial