1
0
Fork 0
firefox/testing/web-platform/tests/shadow-dom/focus-within-shadow.html
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

25 lines
853 B
HTML

<!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>