mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:28:12 +00:00
LibWeb: Fix pseudo-element selector serialization
We want to check the last SimpleSelector, not the first one. We don't have to check that a SimpleSelector exists since a CompoundSelector without one is invalid.
This commit is contained in:
parent
3deb58e4bc
commit
e5d3a9d10b
1 changed files with 4 additions and 5 deletions
|
@ -214,12 +214,11 @@ String Selector::serialize() const
|
|||
break;
|
||||
}
|
||||
} else {
|
||||
// 4. If this is the last part of the chain of the selector and there is a pseudo-element, append "::" followed by the name of the pseudo-element, to s.
|
||||
// FIXME: This doesn't feel entirely correct. Our model of pseudo-elements seems off.
|
||||
if (!compound_selector.simple_selectors.is_empty()
|
||||
&& compound_selector.simple_selectors.first().type == Selector::SimpleSelector::Type::PseudoElement) {
|
||||
// 4. If this is the last part of the chain of the selector and there is a pseudo-element,
|
||||
// append "::" followed by the name of the pseudo-element, to s.
|
||||
if (compound_selector.simple_selectors.last().type == Selector::SimpleSelector::Type::PseudoElement) {
|
||||
s.append("::");
|
||||
s.append(pseudo_element_name(compound_selector.simple_selectors.first().pseudo_element));
|
||||
s.append(pseudo_element_name(compound_selector.simple_selectors.last().pseudo_element));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue