blob: c0a1e624fb79879f7601cba0da5854ae26988a00 (
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
|
<!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>
<div id=host>
<template shadowrootmode=open>
<button><slot></slot></button>
</template>
<span>Content</span>
</div>
<script>
const host = document.getElementById('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>
|