Truly independent web browser
LibWeb: Test :focus-within of a host as its shadow root attaches
Andreas Kling0f317d0cda64
diff --git a/Tests/LibWeb/Text/expected/css/style-engine/focus-within-of-a-host-as-its-shadow-root-attaches.txt b/Tests/LibWeb/Text/expected/css/style-engine/focus-within-of-a-host-as-its-shadow-root-attaches.txtnew file mode 100644index 00000000000..16fc5993b4c--- /dev/null+++ b/Tests/LibWeb/Text/expected/css/style-engine/focus-within-of-a-host-as-its-shadow-root-attaches.txt@@ -0,0 +1,16 @@+Focused: outer true rgb(1, 2, 3)+Focused: host true rgb(1, 2, 3)+Focused: child true rgb(1, 2, 3)+Focused: button true rgb(1, 2, 3)+Attached: outer false rgb(1, 2, 3)+Attached: host false rgb(1, 2, 3)+Attached: child true rgb(1, 2, 3)+Attached: button true rgb(1, 2, 3)+Slotted: outer true rgb(1, 2, 3)+Slotted: host true rgb(1, 2, 3)+Slotted: child true rgb(1, 2, 3)+Slotted: button true rgb(1, 2, 3)+Slot removed: outer false rgb(0, 0, 0)+Slot removed: host false rgb(0, 0, 0)+Slot removed: child true rgb(1, 2, 3)+Slot removed: button true rgb(1, 2, 3)diff --git a/Tests/LibWeb/Text/input/css/style-engine/focus-within-of-a-host-as-its-shadow-root-attaches.html b/Tests/LibWeb/Text/input/css/style-engine/focus-within-of-a-host-as-its-shadow-root-attaches.htmlnew file mode 100644index 00000000000..383ce5f835f--- /dev/null+++ b/Tests/LibWeb/Text/input/css/style-engine/focus-within-of-a-host-as-its-shadow-root-attaches.html@@ -0,0 +1,33 @@+<!doctype html>+<style>+ :focus-within {+ color: rgb(1, 2, 3);+ }+</style>+<div id="outer">+ <div id="host"><div id="child"><button id="button"></button></div></div>+</div>+<script src="../../include.js"></script>+<script>+ test(() => {+ function report(label) {+ for (const id of ["outer", "host", "child", "button"]) {+ const element = document.getElementById(id);+ println(`${label}: ${id} ${element.matches(":focus-within")} ${getComputedStyle(element).color}`);+ }+ }++ document.getElementById("button").focus();+ report("Focused");++ // The children of a host stand in the flat tree only through a slot.+ const shadow = document.getElementById("host").attachShadow({ mode: "open" });+ report("Attached");++ shadow.innerHTML = `<slot></slot>`;+ report("Slotted");++ shadow.firstChild.remove();+ report("Slot removed");+ });+</script>