1
0
Fork 0
firefox/testing/web-platform/tests/selection/textcontrols/selectionchange-on-shadow-dom.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

28 lines
No EOL
873 B
HTML

<!DOCTYPE html>
<meta charset="utf-8">
<title>Test selectionchange events fired on shadow dom</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="root"></div>
<script>
let root = document.getElementById('root');
let shadow = root.attachShadow({ mode: 'open' });
let input = document.createElement('input');
input.value = 'something to do 0';
shadow.append(input);
let events_on_document = [];
document.addEventListener("selectionchange", ev => {
events_on_document.push(ev);
});
promise_test(async () => {
input.focus();
events_on_document.length = 0;
input.setSelectionRange(0, 1);
await new Promise(resolve => step_timeout(resolve, 0));
assert_equals(events_on_document.length, 1);
}, "selectionchange event fired on a shadow dom bubble to the document");
</script>