summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/shadow-dom/focus-within-shadow.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/shadow-dom/focus-within-shadow.html')
-rw-r--r--testing/web-platform/tests/shadow-dom/focus-within-shadow.html29
1 files changed, 29 insertions, 0 deletions
diff --git a/testing/web-platform/tests/shadow-dom/focus-within-shadow.html b/testing/web-platform/tests/shadow-dom/focus-within-shadow.html
new file mode 100644
index 0000000000..e65165a786
--- /dev/null
+++ b/testing/web-platform/tests/shadow-dom/focus-within-shadow.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<link rel="author" href="mailto:masonf@chromium.org">
+<link rel="help" href="https://crbug.com/1300584">
+<script src='/resources/testharness.js'></script>
+<script src='/resources/testharnessreport.js'></script>
+<script src="/resources/declarative-shadow-dom-polyfill.js"></script>
+
+<div id=host>
+ <template shadowrootmode=open>
+ <button><slot></slot></button>
+ </template>
+ <span>Content</span>
+</div>
+
+<script>
+ const host = document.getElementById('host');
+ setup(() => {
+ polyfill_declarative_shadow_dom(host);
+ });
+ test(() => {
+ const shadowButton = host.shadowRoot.querySelector('button');
+ shadowButton.focus();
+ assert_equals(document.activeElement,host,'nodes within shadow DOM aren\'t exposed');
+ host.textContent = 'New Content';
+ assert_equals(document.activeElement,host,'Clearing light DOM shouldn\'t clear focus');
+ },'Don\'t clear focus within shadow root if light DOM children are cleared');
+</script>
+