Skip to content

Commit

Permalink
aria-labelledby idrefs in shadow DOM
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanb committed Jun 22, 2017
1 parent d0a4cee commit 10d1d42
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions shadowDOM/aria_shadow.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
<a href="/">Back to dylanb.github.io</a>
<div class="attach">
</div>
<div>
<p id="target">Thingamabob</p>
</div>
<div class="slotted">
<a href="" aria-labelledby="target">Thing One</a>
</div>
<script>
function createContent() {
var group = document.createElement('div');
Expand All @@ -15,22 +21,31 @@
return group;
}

function createStyle()
{
function createStyle() {
var style = document.createElement('style');
style.textContent = '';
return style;
}

function makeShadowTree(node)
{
function makeShadowTree(node) {
var root = node.attachShadow({mode: 'open'});
root.appendChild(createStyle());
root.appendChild(createContent());
}
function createContentSlotted() {
var group = document.createElement('div');
group.innerHTML = '<div id="target">Stuff<slot></slot></div><a href="" aria-labelledby="target">Thing Two</a>';
return group;
}

function makeShadowTreeSlotted(node) {
var root = node.attachShadow({mode: 'open'});
root.appendChild(createContentSlotted());
}

document.addEventListener('DOMContentLoaded', function() {
document.querySelectorAll('div.attach').forEach(makeShadowTree);
document.querySelectorAll('div.slotted').forEach(makeShadowTreeSlotted);
});
</script>
</body>
Expand Down

0 comments on commit 10d1d42

Please sign in to comment.