blob: e65165a786d6467345390023fd3e014ea0a63246 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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>
|