Files
ladybird/Tests/LibWeb/Text/input/css/stylesheet-add-remove-host-targeted-invalidation-shadow-root.html
Andreas Kling 928a5247ff LibWeb: Narrow stylesheet add/remove invalidation
Avoid broad document invalidation when adding or removing ordinary
document-owned or shadow-owned stylesheets. Reuse the targeted
StyleSheetInvalidation path for style rules, including shadow-host
escapes, pseudo-element-only selectors, and trailing-universal cases.

Keep the broad path for sheet contents whose effects are not captured
by selector invalidation alone, including @property, @font-face,
@font-feature-values, @keyframes, imported sheets, and top-level @layer
blocks. Broad-path shadow-root sheets still reach host-side consumers
through their active-scope effects.
2026-04-23 16:45:22 +02:00

22 lines
618 B
HTML

<!DOCTYPE html>
<script src="../include.js"></script>
<div id="host"></div>
<script>
test(() => {
const host = document.getElementById("host");
const shadowRoot = host.attachShadow({ mode: "open" });
println(`before add: ${getComputedStyle(host).color}`);
const style = document.createElement("style");
style.textContent = ":host { color: rgb(255, 0, 0); }";
shadowRoot.appendChild(style);
println(`after add: ${getComputedStyle(host).color}`);
style.remove();
println(`after remove: ${getComputedStyle(host).color}`);
});
</script>