tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

preferred-stylesheet-reversed-order.html (995B)


      1 <!DOCTYPE html>
      2 <link rel="help" href="https://drafts.csswg.org/cssom/#add-a-css-style-sheet">
      3 <link rel="help" href="https://drafts.csswg.org/cssom/#create-a-css-style-sheet">
      4 <link rel="help" href="https://html.spec.whatwg.org/#update-a-style-block">
      5 <script src="/resources/testharness.js"></script>
      6 <script src="/resources/testharnessreport.js"></script>
      7 <div id="t1">This text should be green</div>
      8 <script>
      9 function createStyleElement(text, title) {
     10    var elm = document.createElement("style");
     11    elm.setAttribute("title", title);
     12    elm.appendChild(document.createTextNode(text));
     13    return elm;
     14 }
     15 
     16 test(function() {
     17    document.head.insertBefore(createStyleElement("#t1 {color:green}", "preferred"), document.head.firstChild);
     18    document.head.insertBefore(createStyleElement("#t1 {color:red}", "notpreferred"), document.head.firstChild);
     19 
     20    assert_equals(getComputedStyle(t1).color, "rgb(0, 128, 0)");
     21 }, "Preferred stylesheet where insertion order is tree order");
     22 </script>