layout/style/test/test_unclosed_parentheses.html

Wed, 31 Dec 2014 07:53:36 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:53:36 +0100
branch
TOR_BUG_3246
changeset 5
4ab42b5ab56c
permissions
-rw-r--r--

Correct small whitespace inconsistency, lost while renaming variables.

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html>
michael@0 3 <!--
michael@0 4 https://bugzilla.mozilla.org/show_bug.cgi?id=575672
michael@0 5 -->
michael@0 6 <head>
michael@0 7 <title>Test for Bug 575672</title>
michael@0 8 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 9 <style type="text/css" id="style"></style>
michael@0 10 <style type="text/css">
michael@0 11 #display { position: relative }
michael@0 12 </style>
michael@0 13 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
michael@0 14 </head>
michael@0 15 <body>
michael@0 16 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=575672">Mozilla Bug 575672</a>
michael@0 17 <p id="display"></p>
michael@0 18 <div id="content" style="display: none">
michael@0 19
michael@0 20 </div>
michael@0 21 <pre id="test">
michael@0 22 <script type="application/javascript">
michael@0 23
michael@0 24 /** Test for unclosed parentheses in CSS values. **/
michael@0 25
michael@0 26 // Each of the following semicolon-terminated @-rules should have a
michael@0 27 // single missing ')' in the value.
michael@0 28 var semirules = [
michael@0 29 "@import (",
michael@0 30 "@import url(",
michael@0 31 "@import url(foo",
michael@0 32 "@import url('foo'",
michael@0 33 "@import foo(",
michael@0 34 ];
michael@0 35
michael@0 36 // Each of the following declarations should have a single missing ')'
michael@0 37 // in the value.
michael@0 38 var declarations = [
michael@0 39 "content: url(",
michael@0 40 "content: url( ",
michael@0 41 "content: url(http://www.foo.com",
michael@0 42 "content: url('http://www.foo.com'",
michael@0 43 "content: foobar(",
michael@0 44 "content: foobar( ",
michael@0 45 "content: foobar(http://www.foo.com",
michael@0 46 "content: foobar('http://www.foo.com'",
michael@0 47 "color: url(",
michael@0 48 "color: url( ",
michael@0 49 "color: url(http://www.foo.com",
michael@0 50 "color: url('http://www.foo.com'",
michael@0 51 "background-image: linear-gradient(",
michael@0 52 "background-image: linear-gradient( ",
michael@0 53 "background-image: linear-gradient(to",
michael@0 54 "background-image: linear-gradient(to top",
michael@0 55 "background-image: linear-gradient(to top left",
michael@0 56 "background-image: linear-gradient(to top left,",
michael@0 57 "background-image: repeating-linear-gradient(to top left, red, blue",
michael@0 58 "background-image: linear-gradient(to top left, red, yellow, blue",
michael@0 59 "background-image: linear-gradient(to top left, red 1px, yellow 5px, blue 10px",
michael@0 60 "background-image: linear-gradient(to top left, red, yellow, rgb(0, 0, 255)",
michael@0 61 "background-image: -moz-linear-gradient(",
michael@0 62 "background-image: -moz-linear-gradient( ",
michael@0 63 "background-image: -moz-linear-gradient(red, blue",
michael@0 64 "background-image: -moz-linear-gradient(red, yellow, blue",
michael@0 65 "background-image: -moz-linear-gradient(red 1px, yellow 5px, blue 10px",
michael@0 66 "background-image: -moz-linear-gradient(red, yellow, rgb(0, 0, 255)",
michael@0 67 "background-image: -moz-linear-gradient(to",
michael@0 68 "background-image: -moz-linear-gradient(to top",
michael@0 69 "background-image: -moz-linear-gradient(to top left",
michael@0 70 "background-image: -moz-linear-gradient(to top left,",
michael@0 71 "background-image: -moz-repeating-linear-gradient(to top left, red, blue",
michael@0 72 "background-image: -moz-linear-gradient(to top left, red, yellow, blue",
michael@0 73 "background-image: -moz-linear-gradient(to top left, red 1px, yellow 5px, blue 10px",
michael@0 74 "background-image: -moz-linear-gradient(to top left, red, yellow, rgb(0, 0, 255)",
michael@0 75 "background-image: -moz-repeating-linear-gradient(top left, red, blue",
michael@0 76 "background-image: -moz-linear-gradient(top left, red, yellow, blue",
michael@0 77 "background-image: -moz-linear-gradient(top left, red 1px, yellow 5px, blue 10px",
michael@0 78 "background-image: -moz-linear-gradient(top left, red, yellow, rgb(0, 0, 255)",
michael@0 79 "background-image: radial-gradient(",
michael@0 80 "background-image: radial-gradient( ",
michael@0 81 "background-image: radial-gradient(at",
michael@0 82 "background-image: radial-gradient(at ",
michael@0 83 "background-image: radial-gradient(at center",
michael@0 84 "background-image: radial-gradient(at center,",
michael@0 85 "background-image: radial-gradient(at center ",
michael@0 86 "background-image: radial-gradient(closest-corner",
michael@0 87 "background-image: radial-gradient(farthest-side ",
michael@0 88 "background-image: radial-gradient(closest-corner ellipse",
michael@0 89 "background-image: radial-gradient(farthest-side circle ",
michael@0 90 "background-image: radial-gradient(closest-corner ellipse at",
michael@0 91 "background-image: radial-gradient(farthest-side circle at ",
michael@0 92 "background-image: radial-gradient(closest-corner ellipse at center",
michael@0 93 "background-image: radial-gradient(farthest-side circle at center ",
michael@0 94 "background-image: radial-gradient(50px",
michael@0 95 "background-image: radial-gradient(50px,",
michael@0 96 "background-image: radial-gradient(50px ",
michael@0 97 "background-image: radial-gradient(50px at",
michael@0 98 "background-image: radial-gradient(50px at ",
michael@0 99 "background-image: radial-gradient(50px at center",
michael@0 100 "background-image: radial-gradient(50px at center ",
michael@0 101 "background-image: radial-gradient(50px at center,",
michael@0 102 "background-image: radial-gradient(50px 50px",
michael@0 103 "background-image: radial-gradient(50px 50px,",
michael@0 104 "background-image: radial-gradient(50px 50px ",
michael@0 105 "background-image: radial-gradient(50px 50px at",
michael@0 106 "background-image: radial-gradient(50px 50px at ",
michael@0 107 "background-image: radial-gradient(50px 50px at center",
michael@0 108 "background-image: radial-gradient(50px 50px at center ",
michael@0 109 "background-image: radial-gradient(50px 50px at center,",
michael@0 110 "background-image: radial-gradient(50px 50px at center, red, blue",
michael@0 111 "background-image: radial-gradient(ellipse at",
michael@0 112 "background-image: radial-gradient(ellipse at ",
michael@0 113 "background-image: radial-gradient(circle",
michael@0 114 "background-image: radial-gradient(circle ",
michael@0 115 "background-image: radial-gradient(circle closest-corner",
michael@0 116 "background-image: radial-gradient(circle farthest-side ",
michael@0 117 "background-image: radial-gradient(ellipse closest-corner at center",
michael@0 118 "background-image: radial-gradient(ellipse farthest-side at center,",
michael@0 119 "background-image: radial-gradient(circle at center",
michael@0 120 "background-image: radial-gradient(circle at center,",
michael@0 121 "background-image: radial-gradient(circle at center ",
michael@0 122 "background-image: radial-gradient(circle at 50px center",
michael@0 123 "background-image: radial-gradient(circle at 50px center ",
michael@0 124 "background-image: radial-gradient(ellipse 50px",
michael@0 125 "background-image: radial-gradient(ellipse 50px ",
michael@0 126 "background-image: radial-gradient(ellipse 50px 50px",
michael@0 127 "background-image: radial-gradient(ellipse 50px 50px,",
michael@0 128 "background-image: radial-gradient(ellipse 50px 50px ",
michael@0 129 "background-image: radial-gradient(ellipse 50px 50px at",
michael@0 130 "background-image: radial-gradient(ellipse 50px 50px at ",
michael@0 131 "background-image: radial-gradient(ellipse 50px 50px at center",
michael@0 132 "background-image: radial-gradient(ellipse 50px 50px at center ",
michael@0 133 "background-image: radial-gradient(ellipse 50px 50px at center,",
michael@0 134 "background-image: radial-gradient(ellipse 50px 50px at center, red, blue",
michael@0 135 "background-image: repeating-radial-gradient(50%",
michael@0 136 "background-image: repeating-radial-gradient(50% ",
michael@0 137 "background-image: repeating-radial-gradient(50% 50%",
michael@0 138 "background-image: repeating-radial-gradient(50% 50%,",
michael@0 139 "background-image: repeating-radial-gradient(50% 50%, red, blue",
michael@0 140 "background-image: -moz-radial-gradient(",
michael@0 141 "background-image: -moz-radial-gradient( ",
michael@0 142 "background-image: -moz-radial-gradient(top left 45deg, red, blue",
michael@0 143 "background-image: -moz-radial-gradient(cover, red, blue",
michael@0 144 "background-image: -moz-repeating-radial-gradient(circle, red, blue",
michael@0 145 "background-image: -moz-radial-gradient(ellipse closest-corner, red, hsl(240, 50%, 50%)",
michael@0 146 "background-image: -moz-radial-gradient(farthest-side circle, red, blue",
michael@0 147 "background-image: -moz-image-rect(",
michael@0 148 "background-image: -moz-image-rect( ",
michael@0 149 "background-image: -moz-image-rect(url(foo.jpg)",
michael@0 150 "background-image: -moz-image-rect(url(foo.jpg), 2, 10, 10",
michael@0 151 "background-image: -moz-image-rect(url(foo.jpg), 2, 10, 10 ",
michael@0 152 "background-image: -moz-image-rect(url(foo.jpg), 2, 10, 10,",
michael@0 153 "background-image: -moz-image-rect(url(foo.jpg), 2, 10, 10, ",
michael@0 154 "background-image: -moz-image-rect(url(foo.jpg), 2, 10, 10, 10",
michael@0 155 "background-image: -moz-image-rect(url(foo.jpg), 2, 10, 10, 10 ",
michael@0 156 "background-image: -moz-image-rect(url(foo.jpg), 2, 10, 10, 10,",
michael@0 157 "background-image: -moz-image-rect(url(foo.jpg), 2, 10, 10, 10, ",
michael@0 158 "color: rgb(",
michael@0 159 "color: rgb( ",
michael@0 160 "color: rgb(128, 0",
michael@0 161 "color: rgb(128, 0, 128",
michael@0 162 "color: rgb(128, 0, 128, 128",
michael@0 163 "color: rgba(",
michael@0 164 "color: rgba( ",
michael@0 165 "color: rgba(128, 0",
michael@0 166 "color: rgba(128, 0, 128",
michael@0 167 "color: rgba(128, 0, 128, 1",
michael@0 168 "color: rgba(128, 0, 128, 1, 1",
michael@0 169 "color: hsl(",
michael@0 170 "color: hsl( ",
michael@0 171 "color: hsl(240, 50%",
michael@0 172 "color: hsl(240, 50%, 50%",
michael@0 173 "color: hsl(240, 50%, 50%, 50%",
michael@0 174 "color: hsla(",
michael@0 175 "color: hsla( ",
michael@0 176 "color: hsla(240, 50%",
michael@0 177 "color: hsla(240, 50%, 50%",
michael@0 178 "color: hsla(240, 50%, 50%, 1",
michael@0 179 "color: hsla(240, 50%, 50%, 1, 1",
michael@0 180 "content: counter(",
michael@0 181 "content: counter( ",
michael@0 182 "content: counter(foo",
michael@0 183 "content: counter(foo ",
michael@0 184 "content: counter(foo,",
michael@0 185 "content: counter(foo, ",
michael@0 186 "content: counter(foo, upper-roman",
michael@0 187 "content: counter(foo, upper-roman ",
michael@0 188 "content: counter(foo, upper-roman,",
michael@0 189 "content: counter(foo, upper-roman, ",
michael@0 190 "content: counters(",
michael@0 191 "content: counters( ",
michael@0 192 "content: counters(foo, ','",
michael@0 193 "content: counters(foo, ',' ",
michael@0 194 "content: counters(foo, ',',",
michael@0 195 "content: counters(foo, ',', ",
michael@0 196 "content: counters(foo, ',', upper-roman",
michael@0 197 "content: counters(foo, ',', upper-roman ",
michael@0 198 "content: counters(foo, ',', upper-roman,",
michael@0 199 "content: counters(foo, ',', upper-roman, ",
michael@0 200 "content: attr(",
michael@0 201 "content: attr( ",
michael@0 202 "content: attr(href",
michael@0 203 "content: attr(href ",
michael@0 204 "content: attr(html",
michael@0 205 "content: attr(html ",
michael@0 206 "content: attr(html|",
michael@0 207 "content: attr(html| ",
michael@0 208 "content: attr(html|href",
michael@0 209 "content: attr(html|href ",
michael@0 210 "content: attr(|",
michael@0 211 "content: attr(| ",
michael@0 212 "content: attr(|href",
michael@0 213 "content: attr(|href ",
michael@0 214 "transition-timing-function: cubic-bezier(",
michael@0 215 "transition-timing-function: cubic-bezier( ",
michael@0 216 "transition-timing-function: cubic-bezier(0, 0, 1",
michael@0 217 "transition-timing-function: cubic-bezier(0, 0, 1 ",
michael@0 218 "transition-timing-function: cubic-bezier(0, 0, 1,",
michael@0 219 "transition-timing-function: cubic-bezier(0, 0, 1, ",
michael@0 220 "transition-timing-function: cubic-bezier(0, 0, 1, 1",
michael@0 221 "transition-timing-function: cubic-bezier(0, 0, 1, 1 ",
michael@0 222 "transition-timing-function: cubic-bezier(0, 0, 1, 1,",
michael@0 223 "transition-timing-function: cubic-bezier(0, 0, 1, 1, ",
michael@0 224 "border-top-width: calc(",
michael@0 225 "border-top-width: calc( ",
michael@0 226 "border-top-width: calc(2em",
michael@0 227 "border-top-width: calc(2em ",
michael@0 228 "border-top-width: calc(2em +",
michael@0 229 "border-top-width: calc(2em + ",
michael@0 230 "border-top-width: calc(2em *",
michael@0 231 "border-top-width: calc(2em * ",
michael@0 232 "border-top-width: calc((2em)",
michael@0 233 "border-top-width: calc((2em) ",
michael@0 234 ];
michael@0 235
michael@0 236 var selectors = [
michael@0 237 ":not(",
michael@0 238 ":not( ",
michael@0 239 ":not(-",
michael@0 240 ":not(- ",
michael@0 241 ":not(>",
michael@0 242 ":not(> ",
michael@0 243 ":not(div p",
michael@0 244 ":not(div p ",
michael@0 245 ":not(div >",
michael@0 246 ":not(div > ",
michael@0 247 ];
michael@0 248
michael@0 249 var textNode = document.createTextNode("");
michael@0 250 document.getElementById("style").appendChild(textNode);
michael@0 251 var cs = getComputedStyle(document.getElementById("display"), "");
michael@0 252
michael@0 253 for (var i = 0; i < semirules.length; ++i) {
michael@0 254 var sheet = semirules[i] +
michael@0 255 "p#display { color: red } ) ; p { color: green; z-index: " + (i + 1) + " }";
michael@0 256 textNode.data = sheet;
michael@0 257 is(cs.color, "rgb(0, 128, 0)",
michael@0 258 "color for rule '" + semirules[i] + "'");
michael@0 259 is(cs.zIndex, i+1,
michael@0 260 "z-index for rule '" + semirules[i] + "'");
michael@0 261 }
michael@0 262
michael@0 263 for (var i = 0; i < declarations.length; ++i) {
michael@0 264 var sheet = "@namespace html url(http://www.w3.org/1999/xhtml);\n" +
michael@0 265 "#display { color: green; " + declarations[i] +
michael@0 266 " x x x x x x x ; color: red; ) ; z-index: " + (i + 1) + " }";
michael@0 267 textNode.data = sheet;
michael@0 268 is(cs.color, "rgb(0, 128, 0)",
michael@0 269 "color for declaration '" + declarations[i] + "'");
michael@0 270 is(cs.zIndex, i+1,
michael@0 271 "z-index for declaration '" + declarations[i] + "'");
michael@0 272 }
michael@0 273
michael@0 274 for (var i = 0; i < selectors.length; ++i) {
michael@0 275 var sheet = "@namespace html url(http://www.w3.org/1999/xhtml);\n" +
michael@0 276 "#display { color: green } " +
michael@0 277 selectors[i] + " x x x x x x x , #display { color: red } #display { color: red } ) , #display { color: red } " +
michael@0 278 "#display { z-index: " + (i + 1) + " }";
michael@0 279 textNode.data = sheet;
michael@0 280 is(cs.color, "rgb(0, 128, 0)",
michael@0 281 "color for selector '" + selectors[i] + "'");
michael@0 282 is(cs.zIndex, i+1,
michael@0 283 "z-index for selector '" + selectors[i] + "'");
michael@0 284 }
michael@0 285
michael@0 286 </script>
michael@0 287 </pre>
michael@0 288 </body>
michael@0 289 </html>

mercurial