Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /shadow-dom/untriaged/shadow-trees/shadow-root-001.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<html>
<head>
<title>Shadow DOM Test: Basic shadow root</title>
<link rel="match" href="shadow-root-001-ref.html">
<link rel="author" title="Hayato Ito" href="mailto:hayato@google.com">
<link rel="author" title="Yuta Kitamura" href="mailto:yutak@google.com">
<meta name="assert" content="When a shadow root is attached, the shadow tree is rendered.">
<script src="../../../html/resources/common.js"></script>
<style>
p { color: black; }
* { color: red; }
</style>
</head>
<body>
<p>You should see green text saying "PASS" below.</p>
<div id="host">FAIL</div>
<script>
var shadowRoot = window.host.attachShadow({mode: 'open'});
shadowRoot.innerHTML =
'<style>#pass { color: green; }</style>\n' +
'<div id="pass">PASS</div>';
</script>
</body>
</html>