mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
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.
20 lines
788 B
HTML
20 lines
788 B
HTML
<!DOCTYPE html>
|
|
<script src="../include.js"></script>
|
|
<div id="target" class="foo">target</div>
|
|
<script>
|
|
test(() => {
|
|
const target = document.getElementById("target");
|
|
const style = document.createElement("style");
|
|
style.textContent = ".foo::before { content: ''; color: rgb(255, 0, 0); background-color: rgb(0, 255, 0); }";
|
|
document.head.appendChild(style);
|
|
|
|
println(`before color: ${getComputedStyle(target, "::before").color}`);
|
|
println(`before background: ${getComputedStyle(target, "::before").backgroundColor}`);
|
|
|
|
style.remove();
|
|
|
|
println(`after color: ${getComputedStyle(target, "::before").color}`);
|
|
println(`after background: ${getComputedStyle(target, "::before").backgroundColor}`);
|
|
});
|
|
</script>
|