summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/dom/shadow/shadowdom-dynamic-styling.html
blob: 10aaaf4d4ceb8ad2f6e3df237859c1df2c81f44a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<!doctype html>
<html>
<head>
  <script src="../../js/resources/js-test-pre.js"></script>
  <script>
description("Test for https://bugs.webkit.org/show_bug.cgi?id=92899. Dynamically styling ShadowDom content on a node distributed to another shadow insertion point fails.");

if (window.testRunner)
   testRunner.dumpAsText();

</script>
</head>
<body>
  <div id="box" style="border: 1px solid black;">
    <div id="item"><div>Content required here to reproduce bug.</div></div>
  </div>
<script>
var box = document.querySelector("#box");
var oldestShadowRoot = box.createShadowRoot();
oldestShadowRoot.innerHTML = "<content></content>";
    
var youngestShadowRoot = document.querySelector("#item").createShadowRoot();
youngestShadowRoot.innerHTML = "<style>" +
      ".selected {background: red;}" +
      "</style>" +
      "<div id='target'>Content</div>";

document.body.offsetLeft;
    
target = youngestShadowRoot.querySelector("div");
target.classList.add("selected");
shouldBe('window.getComputedStyle(target).backgroundColor', '"rgb(255, 0, 0)"');
</script>
</body>
</html>