dom/tests/mochitest/webcomponents/test_style_fallback_content.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/tests/mochitest/webcomponents/test_style_fallback_content.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,28 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=806506
     1.8 +-->
     1.9 +<head>
    1.10 +  <title>Test for styling fallback content</title>
    1.11 +  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.12 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    1.13 +</head>
    1.14 +<body>
    1.15 +<div id="grabme"></div>
    1.16 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=806506">Bug 806506</a>
    1.17 +<script>
    1.18 +var host = document.getElementById("grabme");
    1.19 +var shadow = host.createShadowRoot();
    1.20 +shadow.innerHTML = '<style id="innerstyle"></style><span id="container"><content><span id="innerspan">Hello</span></content></span>';
    1.21 +var innerStyle = shadow.getElementById("innerstyle");
    1.22 +
    1.23 +innerStyle.innerHTML = '#innerspan { margin-top: 10px; }';
    1.24 +var innerSpan = shadow.getElementById("innerspan");
    1.25 +is(getComputedStyle(innerSpan, null).getPropertyValue("margin-top"), "10px", "Default content should be style by id selector.");
    1.26 +
    1.27 +innerStyle.innerHTML = '#container > content > #innerspan { margin-top: 30px; }';
    1.28 +is(getComputedStyle(innerSpan, null).getPropertyValue("margin-top"), "30px", "Default content should be style by child combinators.");
    1.29 +</script>
    1.30 +</body>
    1.31 +</html>

mercurial