1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 19:58:11 +00:00

LibWeb: Fix serialization of selectors with universal subject (*)

For seletors whose subject is unversal (i.e selectors that end in "*")
we were not serializing the asterisk. Instead "foo bar *" came out as
"foo bar foo". This patch fixes that by correctly serializing the last
simple selector if it's universal.
This commit is contained in:
Andreas Kling 2022-03-13 13:16:48 +01:00
parent 8fbe96af45
commit 13c253d2ee

View file

@ -205,7 +205,7 @@ String Selector::serialize() const
// 1. If there is only one simple selector in the compound selectors which is a universal selector, append the result of serializing the universal selector to s.
if (compound_selector.simple_selectors.size() == 1
&& compound_selector.simple_selectors.first().type == Selector::SimpleSelector::Type::Universal) {
s.append(compound_selectors().first().simple_selectors.first().serialize());
s.append(compound_selector.simple_selectors.first().serialize());
}
// 2. Otherwise, for each simple selector in the compound selectors...
// FIXME: ...that is not a universal selector of which the namespace prefix maps to a namespace that is not the default namespace...