mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-27 02:05:07 +02:00
Mark elements reached by stepping through sibling combinators inside :has() and use that breadcrumb during generic invalidation walks. Keep the existing conservative sibling scans for mutations outside those marked subtrees so nested :is(), :not(), and nesting cases continue to invalidate correctly. Also keep :has() eager within compounds that contain ::part(). Those selectors retarget the remaining simple selectors to the part host, so deferring :has() there changes which element the pseudo-class runs against and can make ::part(foo):has(.match) spuriously match. Add a counter-based sibling-scan test and a regression test covering the ::part()/ :has() selector orderings.
20 lines
619 B
HTML
20 lines
619 B
HTML
<!DOCTYPE html>
|
|
<style>
|
|
#host::part(p):has(.match) { background-color: red; }
|
|
#host:has(.match)::part(p) { color: green; }
|
|
</style>
|
|
<div id="host">
|
|
<span class="match"></span>
|
|
</div>
|
|
<script src="../include.js"></script>
|
|
<script>
|
|
test(() => {
|
|
const host = document.getElementById("host");
|
|
const shadow = host.attachShadow({ mode: "open" });
|
|
shadow.innerHTML = `<span id="inner" part="p">text</span>`;
|
|
const inner = shadow.getElementById("inner");
|
|
println(getComputedStyle(inner).backgroundColor);
|
|
println(getComputedStyle(inner).color);
|
|
});
|
|
</script>
|