Skip to content

Commit c0771a6

Browse files
committed
fix: 修复在postcss兼容低版本浏览器的额外样式
1 parent 911569b commit c0771a6

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

src/parse_style_properties.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -124,25 +124,25 @@ pub fn parse_style_properties(properties: &Vec<(String, Property)>) -> DeclsAndV
124124
// 基础样式
125125
"alignContent" => {
126126
final_properties.push(StyleValueType::FlexAlign(FlexAlign::from((
127-
id.to_string(),
127+
property_name.to_string(),
128128
value,
129129
))));
130130
}
131131
"justifyContent" => {
132132
final_properties.push(StyleValueType::FlexAlign(FlexAlign::from((
133-
id.to_string(),
133+
property_name.to_string(),
134134
value,
135135
))));
136136
}
137137
"alignItems" => {
138138
final_properties.push(StyleValueType::AlignItems(ItemAlign::from((
139-
id.to_string(),
139+
property_name.to_string(),
140140
value,
141141
))));
142142
}
143143
"alignSelf" => {
144144
final_properties.push(StyleValueType::AlignItems(ItemAlign::from((
145-
id.to_string(),
145+
property_name.to_string(),
146146
value,
147147
))));
148148
}
@@ -151,43 +151,43 @@ pub fn parse_style_properties(properties: &Vec<(String, Property)>) -> DeclsAndV
151151
}
152152
"flexBasis" => {
153153
final_properties.push(StyleValueType::FlexBasis(FlexBasis::from((
154-
id.to_string(),
154+
property_name.to_string(),
155155
value,
156156
))));
157157
}
158158
"flexDirection" => {
159159
final_properties.push(StyleValueType::FlexDirection(FlexDirection::from((
160-
id.to_string(),
160+
property_name.to_string(),
161161
value,
162162
))));
163163
}
164164
"flexGrow" => {
165165
final_properties.push(StyleValueType::NumberProperty(NumberProperty::from((
166-
id.to_string(),
166+
property_name.to_string(),
167167
value,
168168
))));
169169
}
170170
"flexShrink" => {
171171
final_properties.push(StyleValueType::NumberProperty(NumberProperty::from((
172-
id.to_string(),
172+
property_name.to_string(),
173173
value,
174174
))));
175175
}
176176
"flexWrap" => {
177177
final_properties.push(StyleValueType::FlexWrap(FlexWrap::from((
178-
id.to_string(),
178+
property_name.to_string(),
179179
value,
180180
))));
181181
}
182182
"aspectRatio" => {
183183
final_properties.push(StyleValueType::AspectRatio(AspectRatio::from((
184-
id.to_string(),
184+
property_name.to_string(),
185185
value,
186186
))));
187187
}
188188
"display" => {
189189
final_properties.push(StyleValueType::Display(Display::from((
190-
id.to_string(),
190+
property_name.to_string(),
191191
value,
192192
))));
193193
}

src/style_propetries/style_media.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,8 @@ impl StyleMedia {
340340
fn parse_value(&mut self, feature_val: &MediaFeatureValue) -> Option<MediaValueType> {
341341
match feature_val {
342342
MediaFeatureValue::Length(length_value) => {
343-
return Some(MediaValueType::Length(length_value.clone()));
343+
let length_str = length_value.to_css_string(PrinterOptions::default());
344+
return Some(MediaValueType::String(length_str.unwrap()));
344345
}
345346
MediaFeatureValue::Number(value) => {
346347
return Some(MediaValueType::Float(*value as f64));

0 commit comments

Comments
 (0)