blob: d40324d8a144ff4df849afe5e7b1967a265ba696 [file] [edit]
<!DOCTYPE html>
<!--
Licensed to the Software Freedom Conservancy (SFC) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The SFC licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<html id="root">
<head>
<meta charset="utf-8">
<title>Shadow DOM</title>
</head>
<body id="body">
<div id="host"><p id="light">Light paragraph</p><p id="unslotted" slot="nowhere">Never rendered</p></div>
<div id="named-host"><span id="slotted-b" slot="b">B</span><span id="slotted-a" slot="a">A</span></div>
<div id="outer"></div>
<script>
document.getElementById('host').attachShadow({ mode: 'open' }).innerHTML =
'<h2 id="shadow-heading">Shadow heading</h2><slot id="default-slot"></slot><button id="shadow-button" aria-labelledby="shadow-label">x</button><span id="shadow-label">Shadow label</span>';
document.getElementById('named-host').attachShadow({ mode: 'open' }).innerHTML =
'<p id="p-a"><slot id="slot-a" name="a"></slot></p><p id="p-b"><slot id="slot-b" name="b"></slot></p><slot id="slot-c" name="c"><p id="fallback">Fallback</p></slot>';
document.getElementById('outer').attachShadow({ mode: 'open' }).innerHTML = '<div id="inner"></div>';
document.getElementById('outer').shadowRoot.getElementById('inner').attachShadow({ mode: 'open' }).innerHTML = '<h2 id="inner-heading">Nested</h2>';
</script>
</body>
</html>