layout/style/test/test_bug302186.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html>
michael@0 3 <!--
michael@0 4 https://bugzilla.mozilla.org/show_bug.cgi?id=302186
michael@0 5 -->
michael@0 6 <head>
michael@0 7 <title>Test for Bug 302186</title>
michael@0 8 <script type="text/javascript" src="/MochiKit/Base.js"></script>
michael@0 9 <script type="text/javascript" src="/MochiKit/DOM.js"></script>
michael@0 10 <script type="text/javascript" src="/MochiKit/Style.js"></script>
michael@0 11 <script type="text/javascript" src="/MochiKit/Color.js"></script>
michael@0 12 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 13 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
michael@0 14
michael@0 15 <style>
michael@0 16
michael@0 17
michael@0 18 span { color: red }
michael@0 19 :default + span { color: green }
michael@0 20
michael@0 21 span.reverse { color: green }
michael@0 22 :default + span.reverse { color: red }
michael@0 23
michael@0 24 button { display: none }
michael@0 25 input { display: none }
michael@0 26 </style>
michael@0 27 </head>
michael@0 28 <body>
michael@0 29 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=302186">Mozilla Bug 302186</a>
michael@0 30 <p id="display"></p>
michael@0 31 <div id="content" style="display: block">
michael@0 32
michael@0 33 <!-- static default 1 -->
michael@0 34 <form>
michael@0 35 <div>
michael@0 36 <input type="submit" checked="checked"><span id="s1a">There should be no red.</span>
michael@0 37 </div>
michael@0 38 <div>
michael@0 39 <input type="submit"><span id="s1b" class="reverse">There should be no red.</span>
michael@0 40 </div>
michael@0 41 </form>
michael@0 42
michael@0 43 <!-- static default 2 -->
michael@0 44 <form>
michael@0 45 <div>
michael@0 46 <button type="submit" checked="checked" id="foo"></button>
michael@0 47 <span id="s2a">There should be no red.</span>
michael@0 48 </div>
michael@0 49 <div>
michael@0 50 <button type="submit"></button>
michael@0 51 <span class="reverse" id="s2b">There should be no red.</span>
michael@0 52 </div>
michael@0 53 </form>
michael@0 54
michael@0 55 <!-- static default 3 -->
michael@0 56 <form>
michael@0 57 <div>
michael@0 58 <input type="checkbox" checked="checked" id="foo">
michael@0 59 <span id="s3a">There should be no red.</span>
michael@0 60 </div>
michael@0 61 <div>
michael@0 62 <input checked="checked">
michael@0 63 <span class="reverse" id="s3b">There should be no red.</span>
michael@0 64 </div>
michael@0 65 </form>
michael@0 66
michael@0 67 <!-- static default 3 -->
michael@0 68 <form>
michael@0 69 <div>
michael@0 70 <input type="radio" checked="checked" id="foo">
michael@0 71 <span id="s4a">There should be no red.</span>
michael@0 72 </div>
michael@0 73 <div>
michael@0 74 <input checked="checked">
michael@0 75 <span class="reverse" id="s4b">There should be no red.</span>
michael@0 76 </div>
michael@0 77 </form>
michael@0 78
michael@0 79 <!-- static default 5 -->
michael@0 80 <form>
michael@0 81 <div>
michael@0 82 <input type="image"><span id="s5a">There should be no red.</span>
michael@0 83 </div>
michael@0 84 <div>
michael@0 85 <input type="image"><span id="s5b" class="reverse">There should be no red.</span>
michael@0 86
michael@0 87 </div>
michael@0 88 </form>
michael@0 89
michael@0 90 <!-- dynamic default 1 -->
michael@0 91 <form>
michael@0 92 <div>
michael@0 93 <input type="submit" checked="checked" id="foo1">
michael@0 94 <span class="reverse" id="1a">There should be no red.</span>
michael@0 95 </div>
michael@0 96 <div>
michael@0 97 <input type="submit">
michael@0 98 <span id="1b">There should be no red.</span>
michael@0 99
michael@0 100 </div>
michael@0 101 </form>
michael@0 102
michael@0 103 <!-- dynamic default 2 -->
michael@0 104 <form>
michael@0 105 <div>
michael@0 106 <button type="submit" checked="checked" id="foo2"></button>
michael@0 107 <span class="reverse" id="2a">There should be no red.</span>
michael@0 108 </div>
michael@0 109 <div>
michael@0 110 <button type="submit"></button>
michael@0 111 <span id="2b">There should be no red.</span>
michael@0 112 </div>
michael@0 113 </form>
michael@0 114
michael@0 115 <!-- dynamic default 3 -->
michael@0 116 <form>
michael@0 117 <div>
michael@0 118 <input type="checkbox" checked="checked" id="foo3">
michael@0 119 <span class="reverse" id="3a">There should be no red.</span>
michael@0 120 </div>
michael@0 121 <div>
michael@0 122 <input checked="checked" id="bar3">
michael@0 123 <span id="3b">There should be no red.</span>
michael@0 124 </div>
michael@0 125 </form>
michael@0 126
michael@0 127 <!-- dynamic default 4 -->
michael@0 128 <form>
michael@0 129 <div>
michael@0 130 <input type="radio" checked="checked" id="foo4">
michael@0 131 <span class="reverse" id="4a" >There should be no red.</span>
michael@0 132 </div>
michael@0 133 <div>
michael@0 134 <input checked="checked" id="bar4">
michael@0 135 <span id="4b">There should be no red.</span>
michael@0 136 </div>
michael@0 137 </form>
michael@0 138
michael@0 139 <!-- dynamic default 5 -->
michael@0 140 <form>
michael@0 141 <div>
michael@0 142 <input type="submit">
michael@0 143 <input type="radio" checked="checked" id="foo5">
michael@0 144 <span id="5" class="reverse">There should be no red.</span>
michael@0 145 </div>
michael@0 146 </form>
michael@0 147
michael@0 148 <!-- dynamic default 6 -->
michael@0 149 <form>
michael@0 150 <div id="div6">
michael@0 151 <span id="6a">There should be no red.</span>
michael@0 152 </div>
michael@0 153 <div>
michael@0 154 <input type="submit"><span id="6b" class="reverse">There should be no red.</span>
michael@0 155 </div>
michael@0 156 </form>
michael@0 157
michael@0 158 <!-- dynamic default 7 -->
michael@0 159 <form>
michael@0 160 <div>
michael@0 161 <input type="submit"><span id="7a">There should be no red.</span>
michael@0 162 </div>
michael@0 163 <div id="div7">
michael@0 164 <span class="reverse" id="7b">There should be no red.</span>
michael@0 165
michael@0 166 </div>
michael@0 167 </form>
michael@0 168
michael@0 169 <!-- dynamic default 8 -->
michael@0 170 <form>
michael@0 171 <div id="div8"><span id="8a">There should be no red.</span>
michael@0 172 </div>
michael@0 173 <div>
michael@0 174 <input type="image" id="foo"><span class="reverse" id="8b">There should be no red.</span>
michael@0 175
michael@0 176 </div>
michael@0 177 </form>
michael@0 178
michael@0 179 <!-- dynamic default 9 -->
michael@0 180 <form>
michael@0 181 <div>
michael@0 182 <input type="image"><span id="9a">There should be no red.</span>
michael@0 183 </div>
michael@0 184 <div id="div9">
michael@0 185 <span class="reverse" id="9b">There should be no red.</span>
michael@0 186
michael@0 187 </div>
michael@0 188 </form>
michael@0 189
michael@0 190 <!-- dynamic default 10 -->
michael@0 191 <form>
michael@0 192 <div id="div10">
michael@0 193 <input type="submit"><span id="10a" class="reverse">There should be no red.</span>
michael@0 194 </div>
michael@0 195 <div>
michael@0 196 <input type="submit"><span id="10b" >There should be no red.</span>
michael@0 197
michael@0 198 </div>
michael@0 199 </form>
michael@0 200
michael@0 201 <!-- dynamic default 11 -->
michael@0 202 <form>
michael@0 203 <div id="div11a">
michael@0 204 <input type="submit"><span id="11a">There should be no red.</span>
michael@0 205 </div>
michael@0 206 <div id="div11">
michael@0 207 <input type="submit"><span id="11b" class="reverse">There should be no red.</span>
michael@0 208
michael@0 209 </div>
michael@0 210 </form>
michael@0 211
michael@0 212 <!-- dynamic default 12 -->
michael@0 213 <form>
michael@0 214 <div id="div12">
michael@0 215 <input type="image"><span id="12a" class="reverse">There should be no red.</span>
michael@0 216 </div>
michael@0 217 <div>
michael@0 218 <input type="image"><span id="12b">There should be no red.</span>
michael@0 219
michael@0 220 </div>
michael@0 221 </form>
michael@0 222
michael@0 223 <!-- dynamic default 13 -->
michael@0 224 <form>
michael@0 225 <div id="div13a">
michael@0 226 <input type="image"><span id="13a">There should be no red.</span>
michael@0 227 </div>
michael@0 228 <div id="div13">
michael@0 229 <input type="image"><span id="13b" class="reverse">There should be no red.</span>
michael@0 230
michael@0 231 </div>
michael@0 232 </form>
michael@0 233
michael@0 234 <!-- dynamic default 14 -->
michael@0 235 <form>
michael@0 236 <div id="div14a">
michael@0 237 <input type="submit" id="foo14"><span id="14a">There should be no red.</span>
michael@0 238 </div>
michael@0 239 <div id="div14b">
michael@0 240 <input type="submit" id="foo14b"><span id="14b" class="reverse">There should be no red.</span>
michael@0 241
michael@0 242 </div>
michael@0 243 </form>
michael@0 244
michael@0 245 <!-- dynamic default 15 -->
michael@0 246 <form>
michael@0 247 <div id="div15a">
michael@0 248 <input type="image" id="foo15a"><span id="15a">There should be no red.</span>
michael@0 249 </div>
michael@0 250 <div id="div15b">
michael@0 251 <input type="image" id="foo15b"><span id="15b" class="reverse">There should be no red.</span>
michael@0 252
michael@0 253 </div>
michael@0 254 </form>
michael@0 255
michael@0 256 <!-- dynamic default 16 -->
michael@0 257 <form>
michael@0 258 <div>
michael@0 259 <input type="image" checked="checked" id="foo16"></button>
michael@0 260 <span class="reverse" id="16a">There should be no red.</span>
michael@0 261 </div>
michael@0 262 <div>
michael@0 263 <input type="image"></button><span id="16b">There should be no red.</span>
michael@0 264
michael@0 265 </div>
michael@0 266 </form>
michael@0 267
michael@0 268 <!-- dynamic default 17 -->
michael@0 269 <form>
michael@0 270 <div>
michael@0 271 <button type="button" id="foo17"></button>
michael@0 272 <span id="17a">There should be no red.</span>
michael@0 273 </div>
michael@0 274 <div>
michael@0 275 <button type="submit"></button><span class="reverse" id="17b">There should be no red.</span>
michael@0 276 </div>
michael@0 277 </form>
michael@0 278
michael@0 279 <!-- dynamic default 18 -->
michael@0 280 <form>
michael@0 281 <div>
michael@0 282 <input type="button" id="foo18"></button>
michael@0 283 <span id="18a">There should be no red.</span>
michael@0 284 </div>
michael@0 285 <div>
michael@0 286 <input type="submit"></button><span id="18b" class="reverse">There should be no red.</span>
michael@0 287
michael@0 288 </div>
michael@0 289 </form>
michael@0 290
michael@0 291 <!-- dynamic default 19 -->
michael@0 292 <form>
michael@0 293 <div id="div19">
michael@0 294 <span id="19a">There should be no red.</span>
michael@0 295 </div>
michael@0 296 </form>
michael@0 297
michael@0 298 <!-- dynamic default 20 -->
michael@0 299 <form>
michael@0 300 <div id="div20">
michael@0 301 <span id="20a">There should be no red.</span>
michael@0 302 </div>
michael@0 303 </form>
michael@0 304
michael@0 305 </div>
michael@0 306
michael@0 307 <pre id="test">
michael@0 308 <script class="testbody" type="text/javascript">
michael@0 309
michael@0 310 /** Test for Bug 302186 **/
michael@0 311
michael@0 312 SimpleTest.waitForExplicitFinish();
michael@0 313
michael@0 314 function idColor(anId) {
michael@0 315 var color = Color.fromComputedStyle(anId, "color");
michael@0 316 return color.toRGBString();
michael@0 317 }
michael@0 318
michael@0 319 is(idColor("s1a"),"rgb(0,128,0)", "CSS static-default 1a");
michael@0 320 is(idColor("s1b"),"rgb(0,128,0)", "CSS static-default 1b");
michael@0 321 is(idColor("s2a"),"rgb(0,128,0)", "CSS static-default 2a");
michael@0 322 is(idColor("s2b"),"rgb(0,128,0)", "CSS static-default 2b");
michael@0 323 is(idColor("s3a"),"rgb(0,128,0)", "CSS static-default 3a");
michael@0 324 is(idColor("s3b"),"rgb(0,128,0)", "CSS static-default 3b");
michael@0 325 is(idColor("s4a"),"rgb(0,128,0)", "CSS static-default 4a");
michael@0 326 is(idColor("s4b"),"rgb(0,128,0)", "CSS static-default 4b");
michael@0 327 is(idColor("s5a"),"rgb(0,128,0)", "CSS static-default 5a");
michael@0 328 is(idColor("s5b"),"rgb(0,128,0)", "CSS static-default 5b");
michael@0 329
michael@0 330 function dynamicDefault1() {
michael@0 331 $('foo1').removeAttribute("type");
michael@0 332 is(idColor("1a"),"rgb(0,128,0)", "CSS dynamic-default 1a");
michael@0 333 is(idColor("1b"),"rgb(0,128,0)", "CSS dynamic-default 1b");
michael@0 334 }
michael@0 335
michael@0 336 function dynamicDefault2() {
michael@0 337 $('foo2').setAttribute("type", "button");
michael@0 338 is(idColor("2a"),"rgb(0,128,0)", "CSS dynamic-default 2a");
michael@0 339 is(idColor("2b"),"rgb(0,128,0)", "CSS dynamic-default 2b");
michael@0 340 }
michael@0 341
michael@0 342 function dynamicDefault3() {
michael@0 343 $('foo3').removeAttribute("type");
michael@0 344 $('bar3').setAttribute("type", "checkbox");
michael@0 345 is(idColor("3a"),"rgb(0,128,0)", "CSS dynamic-default 3a");
michael@0 346 is(idColor("3b"),"rgb(0,128,0)", "CSS dynamic-default 3b");
michael@0 347 }
michael@0 348
michael@0 349 function dynamicDefault4() {
michael@0 350 $('foo4').removeAttribute("type");
michael@0 351 $('bar4').setAttribute("type", "radio");
michael@0 352 is(idColor("4a"),"rgb(0,128,0)", "CSS dynamic-default 4a");
michael@0 353 is(idColor("4b"),"rgb(0,128,0)", "CSS dynamic-default 4b");
michael@0 354 }
michael@0 355
michael@0 356 function dynamicDefault5() {
michael@0 357 $('foo5').setAttribute("type", "submit")
michael@0 358 is(idColor("5"),"rgb(0,128,0)", "CSS dynamic-default 5");
michael@0 359 }
michael@0 360
michael@0 361 function dynamicDefault6() {
michael@0 362 var but = document.createElement("input");
michael@0 363 but.setAttribute("type", "submit");
michael@0 364 $('div6').insertBefore(but, $('div6').firstChild);
michael@0 365 is(idColor("6a"),"rgb(0,128,0)", "CSS dynamic-default 6a");
michael@0 366 is(idColor("6b"),"rgb(0,128,0)", "CSS dynamic-default 6b");
michael@0 367 }
michael@0 368
michael@0 369 function dynamicDefault7() {
michael@0 370 var but = document.createElement("input");
michael@0 371 but.setAttribute("type", "submit");
michael@0 372 $('div7').insertBefore(but, $('div7').firstChild);
michael@0 373 is(idColor("7a"),"rgb(0,128,0)", "CSS dynamic-default 7a");
michael@0 374 is(idColor("7b"),"rgb(0,128,0)", "CSS dynamic-default 7b");
michael@0 375 }
michael@0 376
michael@0 377 function dynamicDefault8() {
michael@0 378 var but = document.createElement("input");
michael@0 379 but.setAttribute("type", "image");
michael@0 380 $('div8').insertBefore(but, $('div8').firstChild);
michael@0 381 is(idColor("8a"),"rgb(0,128,0)", "CSS dynamic-default 8a");
michael@0 382 is(idColor("8b"),"rgb(0,128,0)", "CSS dynamic-default 8b");
michael@0 383 }
michael@0 384
michael@0 385 function dynamicDefault9() {
michael@0 386 var but = document.createElement("input");
michael@0 387 but.setAttribute("type", "image");
michael@0 388 $('div9').insertBefore(but, $('div9').firstChild);
michael@0 389 is(idColor("9a"),"rgb(0,128,0)", "CSS dynamic-default 9a");
michael@0 390 is(idColor("9b"),"rgb(0,128,0)", "CSS dynamic-default 9b");
michael@0 391 }
michael@0 392
michael@0 393 function dynamicDefault10() {
michael@0 394 var inputs = $('div10').getElementsByTagName("input");
michael@0 395 $('div10').removeChild(inputs[0]);
michael@0 396 is(idColor("10a"),"rgb(0,128,0)", "CSS dynamic-default 10a");
michael@0 397 is(idColor("10b"),"rgb(0,128,0)", "CSS dynamic-default 10b");
michael@0 398 }
michael@0 399
michael@0 400 function dynamicDefault11() {
michael@0 401 var inputs = $('div11').getElementsByTagName("input");
michael@0 402 $('div11').removeChild(inputs[0]);
michael@0 403 is(idColor("11a"),"rgb(0,128,0)", "CSS dynamic-default 11a");
michael@0 404 is(idColor("11b"),"rgb(0,128,0)", "CSS dynamic-default 11b");
michael@0 405 }
michael@0 406
michael@0 407 function dynamicDefault12() {
michael@0 408 var inputs = $('div12').getElementsByTagName("input");
michael@0 409 $('div12').removeChild(inputs[0]);
michael@0 410 is(idColor("12a"),"rgb(0,128,0)", "CSS dynamic-default 12a");
michael@0 411 is(idColor("12b"),"rgb(0,128,0)", "CSS dynamic-default 12b");
michael@0 412 }
michael@0 413
michael@0 414 function dynamicDefault13() {
michael@0 415 var inputs = $('div13').getElementsByTagName("input");
michael@0 416 $('div13').removeChild(inputs[0]);
michael@0 417 is(idColor("13a"),"rgb(0,128,0)", "CSS dynamic-default 13a");
michael@0 418 is(idColor("13b"),"rgb(0,128,0)", "CSS dynamic-default 13b");
michael@0 419 }
michael@0 420
michael@0 421 function dynamicDefault14() {
michael@0 422 var div1 = document.getElementById("div14a");
michael@0 423 var inputs = div1.getElementsByTagName("input");
michael@0 424 var firstElement = div1.removeChild(inputs[0]);
michael@0 425 var div2 = document.getElementById("div14b");
michael@0 426 inputs = div2.getElementsByTagName("input");
michael@0 427 var secondElement = div2.removeChild(inputs[0]);
michael@0 428 div1.insertBefore(secondElement, div1.firstChild);
michael@0 429 div2.insertBefore(firstElement, div2.firstChild);
michael@0 430 is(idColor("14a"),"rgb(0,128,0)", "CSS dynamic-default 14a");
michael@0 431 is(idColor("14b"),"rgb(0,128,0)", "CSS dynamic-default 14b");
michael@0 432 }
michael@0 433
michael@0 434 function dynamicDefault15() {
michael@0 435 var div1 = document.getElementById("div15a");
michael@0 436 var inputs = div1.getElementsByTagName("input");
michael@0 437 var firstElement = div1.removeChild(inputs[0]);
michael@0 438 var div2 = document.getElementById("div15b");
michael@0 439 inputs = div2.getElementsByTagName("input");
michael@0 440 var secondElement = div2.removeChild(inputs[0]);
michael@0 441 div1.insertBefore(secondElement, div1.firstChild);
michael@0 442 div2.insertBefore(firstElement, div2.firstChild);
michael@0 443 is(idColor("15a"),"rgb(0,128,0)", "CSS dynamic-default 15a");
michael@0 444 is(idColor("15b"),"rgb(0,128,0)", "CSS dynamic-default 15b");
michael@0 445 }
michael@0 446
michael@0 447 function dynamicDefault16() {
michael@0 448 $("foo16").setAttribute("type", "button");
michael@0 449 is(idColor("16a"),"rgb(0,128,0)", "CSS dynamic-default 16a");
michael@0 450 is(idColor("16b"),"rgb(0,128,0)", "CSS dynamic-default 16b");
michael@0 451 }
michael@0 452
michael@0 453 function dynamicDefault17() {
michael@0 454 $("foo17").setAttribute("type", "submit");
michael@0 455 is(idColor("17a"),"rgb(0,128,0)", "CSS dynamic-default 17a");
michael@0 456 is(idColor("17b"),"rgb(0,128,0)", "CSS dynamic-default 17b");
michael@0 457 }
michael@0 458
michael@0 459 function dynamicDefault18() {
michael@0 460 $("foo18").setAttribute("type", "submit");
michael@0 461 is(idColor("18a"),"rgb(0,128,0)", "CSS dynamic-default 18a");
michael@0 462 is(idColor("18b"),"rgb(0,128,0)", "CSS dynamic-default 18b");
michael@0 463 }
michael@0 464
michael@0 465 function dynamicDefault19() {
michael@0 466 var newSubmit = document.createElement("input");
michael@0 467 newSubmit.setAttribute("type", "submit");
michael@0 468 var div1 = document.getElementById("div19");
michael@0 469 div1.insertBefore(newSubmit, div1.firstChild);
michael@0 470 is(idColor("19a"),"rgb(0,128,0)", "CSS dynamic-default 19a");
michael@0 471 }
michael@0 472
michael@0 473 function dynamicDefault20() {
michael@0 474 var newSubmit = document.createElement("input");
michael@0 475 newSubmit.setAttribute("type", "image");
michael@0 476 var div1 = document.getElementById("div20");
michael@0 477 div1.insertBefore(newSubmit, div1.firstChild);
michael@0 478 is(idColor("20a"),"rgb(0,128,0)", "CSS dynamic-default 20a");
michael@0 479 }
michael@0 480
michael@0 481 addLoadEvent(dynamicDefault1);
michael@0 482 addLoadEvent(dynamicDefault2);
michael@0 483 addLoadEvent(dynamicDefault3);
michael@0 484 addLoadEvent(dynamicDefault4);
michael@0 485 addLoadEvent(dynamicDefault5);
michael@0 486 addLoadEvent(dynamicDefault6);
michael@0 487 addLoadEvent(dynamicDefault7);
michael@0 488 addLoadEvent(dynamicDefault8);
michael@0 489 addLoadEvent(dynamicDefault9);
michael@0 490 addLoadEvent(dynamicDefault10);
michael@0 491 addLoadEvent(dynamicDefault11);
michael@0 492 addLoadEvent(dynamicDefault12);
michael@0 493 addLoadEvent(dynamicDefault13);
michael@0 494 addLoadEvent(dynamicDefault14);
michael@0 495 addLoadEvent(dynamicDefault15);
michael@0 496 addLoadEvent(dynamicDefault16);
michael@0 497 addLoadEvent(dynamicDefault17);
michael@0 498 addLoadEvent(dynamicDefault18);
michael@0 499 addLoadEvent(dynamicDefault19);
michael@0 500 addLoadEvent(dynamicDefault20);
michael@0 501
michael@0 502 addLoadEvent(SimpleTest.finish);
michael@0 503
michael@0 504 </script>
michael@0 505 </pre>
michael@0 506 </body>
michael@0 507 </html>
michael@0 508

mercurial