Skip to content

Commit f12d632

Browse files
committed
fix: 修复选择器被合并导致匹配异常、修复fontfamliy不能有数字
1 parent 3fbbe99 commit f12d632

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

src/parse_style_properties.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -269,11 +269,9 @@ pub fn parse_style_properties(properties: &Vec<(String, Property)>) -> DeclsAndV
269269
))));
270270
}
271271
"fontFamily" => {
272-
final_properties.push(StyleValueType::Normal(Normal::new(
272+
final_properties.push(StyleValueType::Expr(Expr::new(
273273
CSSPropertyType::FontFamily,
274-
value
275-
.value_to_css_string(PrinterOptions::default())
276-
.unwrap(),
274+
generate_expr_lit_str!(value.value_to_css_string(PrinterOptions::default()).unwrap()),
277275
)));
278276
}
279277
"lineHeight" => {

src/style_parser.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -236,15 +236,15 @@ impl<'i> Visitor<'i> for StyleVisitor<'i> {
236236

237237
for (index, selector) in selectors.iter().enumerate() {
238238
let mut all_style = self.all_style.borrow_mut();
239-
let decorations = all_style
240-
.iter_mut()
241-
.find(|(media_idx, id, _)| id == selector && media_idx == &self.media_index);
242-
if let Some((_, _, declarations)) = decorations {
243-
declarations.push(StyleDeclaration {
244-
specificity: style.selectors.0.get(index).unwrap().specificity(),
245-
declaration: style.declarations.clone(),
246-
});
247-
} else {
239+
// let decorations = all_style
240+
// .iter_mut()
241+
// .find(|(media_idx, id, _)| id == selector && media_idx == &self.media_index);
242+
// if let Some((_, _, declarations)) = decorations {
243+
// declarations.push(StyleDeclaration {
244+
// specificity: style.selectors.0.get(index).unwrap().specificity(),
245+
// declaration: style.declarations.clone(),
246+
// });
247+
// } else {
248248
all_style.push((
249249
self.media_index,
250250
selector.clone(),
@@ -253,7 +253,7 @@ impl<'i> Visitor<'i> for StyleVisitor<'i> {
253253
declaration: style.declarations.clone(),
254254
}],
255255
));
256-
}
256+
// }
257257
}
258258
}
259259
// media

0 commit comments

Comments
 (0)