mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 17:55:07 +02:00
The selector matching code bypassed the pseudo-element type check for `::part()` selectors to support compound selectors like `::part(foo)::before`. This caused bare ::part() declarations to leak into unrelated pseudo-elements like ::selection. Fix this by finding any additional pseudo-element beyond ::part() in the selector and verifying it matches the target.
17 lines
550 B
HTML
17 lines
550 B
HTML
<!DOCTYPE html>
|
|
<style>
|
|
#host::part(p) { background-color: red; }
|
|
</style>
|
|
<div id="host"></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, "::selection").backgroundColor);
|
|
});
|
|
</script>
|