blob: f0eefeb02ea01328193f08ecf3112b335754829c [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../../resources/js-test-pre.js"></script>
<style>
p::x-shadow-child {
color: red;
}
a::x-nested-shadow-child {
color: blue;
}
p::x-shadow-child::x-nested-shadow-child {
background-color: green;
}
</style>
</head>
<body>
<div id="console"></div>
<p id="host"></div>
<script>
function buildShadowWithOneChild(host, childTagName, childPseudoId)
{
var shadow = host.webkitCreateShadowRoot();
var shadowChild = document.createElement(childTagName);
shadow.appendChild(shadowChild);
internals.setShadowPseudoId(shadowChild, childPseudoId);
return { host: host, shadow: shadow, shadowChild: shadowChild };
}
description("Nested pseudo id should be matchable");
if (!window.internals)
fail("You need window.internals to run this test");
var host = document.getElementById("host");
var tuple = buildShadowWithOneChild(host, "a", "x-shadow-child");
shouldBe("window.getComputedStyle(tuple.shadowChild).color", "'rgb(255, 0, 0)'");
var shadowTuple = buildShadowWithOneChild(tuple.shadowChild, "b", "x-nested-shadow-child");
shouldBe("window.getComputedStyle(shadowTuple.shadowChild).color", "'rgb(0, 0, 255)'");
shouldBe("window.getComputedStyle(shadowTuple.shadowChild).backgroundColor", "'rgb(0, 128, 0)'");
var successfullyParsed = true;
</script>
<script src="../../../resources/js-test-post.js"></script>
</body>
</html>