tor-browser

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

variable-created-document.html (1564B)


      1 <!DOCTYPE html>
      2 <html>
      3 <head>
      4    <title>Variable added to created document</title>
      5 
      6    <meta rel="author" title="Kevin Babbitt">
      7    <meta rel="author" title="Greg Whitworth">
      8    <link rel="author" title="Microsoft Corporation" href="http://microsoft.com" />
      9    <!-- This is not directly stated in the spec, but still worth testing to ensure it works -->
     10    <link rel="help" href="http://www.w3.org/TR/css-variables-1/#defining-variables">
     11 
     12    <script src="/resources/testharness.js"></script>
     13    <script src="/resources/testharnessreport.js"></script>
     14 </head>
     15 <body>
     16    <div id="target">This text should be green.</div>
     17    <script type="text/javascript">
     18        "use strict";
     19 
     20        var workDocument = document.implementation.createHTMLDocument("");
     21        workDocument.documentElement.innerHTML = "<style id='style'>#target { --c: rgb(0, 136, 0); color: var(--c) }</style>";
     22        document.head.appendChild(workDocument.getElementById("style"));
     23 
     24        test( function () {
     25            assert_equals(window.getComputedStyle(document.getElementById("target")).getPropertyValue("--c").trim(), "rgb(0, 136, 0)");
     26        }, "Variable definition appearing in a created document should work once spliced into the creating document");
     27 
     28        test( function () {
     29            assert_equals(window.getComputedStyle(document.getElementById("target")).getPropertyValue("color").trim(), "rgb(0, 136, 0)");
     30        }, "Variable reference appearing in a created document should work once spliced into the creating document");
     31 
     32    </script>
     33 </body>
     34 </html>