optimize common case of single style
This commit is contained in:
parent
f582439744
commit
0b28bb4c35
@ -237,12 +237,15 @@ impl<'a> Parser<'a> {
|
||||
'!' | '{' => return Err(("expected \"}\".", *pos).into()),
|
||||
_ => match self.is_selector_or_style()? {
|
||||
SelectorOrStyle::Style(property, value) => {
|
||||
let styles = if let Some(value) = value {
|
||||
vec![Style { property, value }]
|
||||
if let Some(value) = value {
|
||||
stmts.push(Stmt::Style(Style { property, value }));
|
||||
} else {
|
||||
self.parse_style_group(property)?
|
||||
};
|
||||
stmts.extend(styles.into_iter().map(Stmt::Style));
|
||||
stmts.extend(
|
||||
self.parse_style_group(property)?
|
||||
.into_iter()
|
||||
.map(Stmt::Style),
|
||||
);
|
||||
}
|
||||
}
|
||||
SelectorOrStyle::Selector(init) => {
|
||||
let at_root = self.at_root;
|
||||
|
Loading…
x
Reference in New Issue
Block a user