layout/style/test/test_bug357614.html

Wed, 31 Dec 2014 06:55:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:50 +0100
changeset 2
7e26c7da4463
permissions
-rw-r--r--

Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html>
michael@0 3 <!--
michael@0 4 https://bugzilla.mozilla.org/show_bug.cgi?id=357614
michael@0 5 -->
michael@0 6 <head>
michael@0 7 <title>Test for Bug 357614</title>
michael@0 8 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 9 <style type="text/css" id="style">
michael@0 10 a { color: red; }
michael@0 11 a { color: green; }
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=357614">Mozilla Bug 357614</a>
michael@0 17 <p id="display"><a href="http://www.FOO.com/" rel="next" rev="PREV" foo="bar">a link</a></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 class="testbody" type="text/javascript">
michael@0 23
michael@0 24 /** Test for Bug 357614 **/
michael@0 25
michael@0 26 var sheet = document.getElementById("style").sheet;
michael@0 27 var rule1 = sheet.cssRules[0];
michael@0 28 var rule2 = sheet.cssRules[1];
michael@0 29
michael@0 30 var a = document.getElementById("display").firstChild;
michael@0 31 var cs = getComputedStyle(a, "");
michael@0 32
michael@0 33 function change_selector_text(selector) {
michael@0 34 // rule2.selectorText = selector; // NOT IMPLEMENTED
michael@0 35
michael@0 36 sheet.deleteRule(1);
michael@0 37 sheet.insertRule(selector + " { color: green; }", 1);
michael@0 38 }
michael@0 39
michael@0 40 var cs_green = cs.getPropertyValue("color");
michael@0 41 change_selector_text('p');
michael@0 42 var cs_red = cs.getPropertyValue("color");
michael@0 43 isnot(cs_green, cs_red, "computed values for green and red are different");
michael@0 44
michael@0 45 change_selector_text('a[href="http://www.FOO.com/"]');
michael@0 46 is(cs.getPropertyValue("color"), cs_green, "selector on href value matches case-sensitively");
michael@0 47
michael@0 48 change_selector_text('a[href="http://www.foo.com/"]');
michael@0 49 is(cs.getPropertyValue("color"), cs_red, "selector on href value does not match case-insensitively");
michael@0 50
michael@0 51 change_selector_text('a[rel="next"]');
michael@0 52 is(cs.getPropertyValue("color"), cs_green, "selector on rel value matches case-sensitively");
michael@0 53
michael@0 54 change_selector_text('a[rel="NEXT"]');
michael@0 55 is(cs.getPropertyValue("color"), cs_green, "selector on rel value matches case-insensitively");
michael@0 56
michael@0 57 change_selector_text('a[rev="PREV"]');
michael@0 58 is(cs.getPropertyValue("color"), cs_green, "selector on rev value matches case-sensitively");
michael@0 59
michael@0 60 change_selector_text('a[rev="prev"]');
michael@0 61 is(cs.getPropertyValue("color"), cs_green, "selector on rev value matches case-insensitively");
michael@0 62
michael@0 63 change_selector_text('a[foo="bar"]');
michael@0 64 is(cs.getPropertyValue("color"), cs_green, "selector on foo value matches case-sensitively");
michael@0 65
michael@0 66 change_selector_text('a[foo="Bar"]');
michael@0 67 is(cs.getPropertyValue("color"), cs_red, "selector on foo value does not match case-insensitively");
michael@0 68
michael@0 69 </script>
michael@0 70 </pre>
michael@0 71 </body>
michael@0 72 </html>
michael@0 73

mercurial