tor-browser

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

test_style_fallback_content.html (1457B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=806506
      5 -->
      6 <head>
      7  <title>Test for styling fallback content</title>
      8  <script type="text/javascript" src="head.js"></script>
      9  <script src="/tests/SimpleTest/SimpleTest.js"></script>
     10  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
     11 </head>
     12 <body>
     13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=806506">Bug 806506</a>
     14 <script>
     15 
     16 SimpleTest.waitForExplicitFinish();
     17 
     18 var content = '<div id="grabme"></div>';
     19 createIframe(content)
     20  .then((aDocument) => {
     21    var iframeWin = aDocument.defaultView;
     22 
     23    var host = aDocument.getElementById("grabme");
     24    var shadow = host.attachShadow({mode: "open"});
     25    shadow.innerHTML = '<style id="innerstyle"></style><span id="container"><slot><span id="innerspan">Hello</span></slot></span>';
     26    var innerStyle = shadow.getElementById("innerstyle");
     27 
     28    innerStyle.innerHTML = '#innerspan { margin-top: 10px; }';
     29    var innerSpan = shadow.getElementById("innerspan");
     30    is(iframeWin.getComputedStyle(innerSpan).getPropertyValue("margin-top"), "10px", "Default content should be style by id selector.");
     31 
     32    innerStyle.innerHTML = '#container > slot > #innerspan { margin-top: 30px; }';
     33    is(iframeWin.getComputedStyle(innerSpan).getPropertyValue("margin-top"), "30px", "Default content should be style by child combinators.");
     34 
     35    SimpleTest.finish();
     36  });
     37 </script>
     38 </body>
     39 </html>