mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-03 07:32:00 +00:00
Attempt 2! Reverts 2a5dbedad4
This time, set up a different combinator when producing a relative
invalid selector rather than a standalone one. This fixes the crash.
Original description below for simplicity because it still applies.
---
Selectors like `:is(.valid, &!?!?!invalid)` need to keep the invalid
part around, even though it will never match, for a couple of reasons:
- Serialization needs to include them
- For nesting, we care if a `&` appeared anywhere in the selector, even
in an invalid part.
So this patch introduces an `Invalid` simple selector type, which simply
holds its original ComponentValues. We search through these looking for
`&`, and we dump them out directly when asked to serialize.
17 lines
518 B
HTML
17 lines
518 B
HTML
<!DOCTYPE html>
|
|
<style id="style"></style>
|
|
<script src="../include.js"></script>
|
|
<script>
|
|
test(() => {
|
|
const selectors = [
|
|
":is(hello, !?)",
|
|
":is(what, :fake(:imaginary), really)",
|
|
];
|
|
let stylesheet = document.styleSheets[0];
|
|
for (let selector of selectors) {
|
|
stylesheet.insertRule(`${selector} { }`);
|
|
println(`${selector} -> ${stylesheet.cssRules[0].selectorText}`);
|
|
stylesheet.deleteRule(0);
|
|
}
|
|
});
|
|
</script>
|