Skip to content

Commit

Permalink
Add the shadowrootdelegatesfocus attribute to declarative Shadow DOM
Browse files Browse the repository at this point in the history
This CL adds the ability to control the delegatesFocus (and eventually
the manualSlotting) parameter of the attachShadow command using
declarative Shadow DOM.

Bug: 1042130
Change-Id: I8cc973ca196151fdc29a1194e25eb86f15849e16
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2107362
Commit-Queue: Mason Freed <masonfreed@chromium.org>
Reviewed-by: Kouhei Ueno <kouhei@chromium.org>
Auto-Submit: Mason Freed <masonfreed@chromium.org>
Cr-Commit-Position: refs/heads/master@{#752229}
  • Loading branch information
mfreed7 authored and chromium-wpt-export-bot committed Mar 21, 2020
1 parent b563442 commit f2c1dfe
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions shadow-dom/declarative/declarative-shadow-dom.tentative.html
Expand Up @@ -92,5 +92,26 @@
assert_true(!!s1,"Slot should be inside the shadow root");
}, 'Declarative Shadow DOM: Missing closing tag');

test(() => {
const div = document.createElement('div');
div.innerHTML = `
<div id="host">
<template shadowroot="open" shadowrootdelegatesfocus>
</template>
</div>
`;
var host = div.querySelector('#host');
assert_true(!!host.shadowRoot,"No shadow root found");
assert_true(host.shadowRoot.delegatesFocus,"delegatesFocus should be true");
div.innerHTML = `
<div id="host">
<template shadowroot="open">
</template>
</div>
`;
host = div.querySelector('#host');
assert_true(!!host.shadowRoot,"No shadow root found");
assert_false(host.shadowRoot.delegatesFocus,"delegatesFocus should be false without the shadowrootdelegatesfocus attribute");
}, 'Declarative Shadow DOM: delegates focus attribute');

</script>

0 comments on commit f2c1dfe

Please sign in to comment.