Skip to content

Commit 60b325b

Browse files
committed
Fix unparsed display values
1 parent ac660f1 commit 60b325b

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4723,6 +4723,10 @@ mod tests {
47234723
".foo { display: -webkit-inline-flex; display: -moz-inline-box; display: inline-flex }",
47244724
".foo{display:-webkit-inline-flex;display:-moz-inline-box;display:inline-flex}"
47254725
);
4726+
minify_test(
4727+
".foo { display: flex; display: var(--grid); }",
4728+
".foo{display:flex;display:var(--grid)}"
4729+
);
47264730
prefix_test(
47274731
".foo{ display: flex }",
47284732
indoc! {r#"

src/properties/display.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use cssparser::*;
2-
use super::Property;
2+
use super::{Property, PropertyId};
3+
use super::custom::UnparsedProperty;
34
use crate::vendor_prefix::VendorPrefix;
45
use crate::declaration::DeclarationList;
56
use crate::targets::Browsers;
@@ -308,7 +309,7 @@ impl DisplayHandler {
308309
}
309310

310311
impl PropertyHandler for DisplayHandler {
311-
fn handle_property(&mut self, property: &Property, _: &mut DeclarationList) -> bool {
312+
fn handle_property(&mut self, property: &Property, dest: &mut DeclarationList) -> bool {
312313
if let Property::Display(display) = property {
313314
match (&self.display, display) {
314315
(Some(Display::Pair(cur)), Display::Pair(new)) => {
@@ -334,6 +335,12 @@ impl PropertyHandler for DisplayHandler {
334335
self.display = Some(display.clone());
335336
return true
336337
}
338+
339+
if matches!(property, Property::Unparsed(UnparsedProperty { property_id: PropertyId::Display, .. })) {
340+
self.finalize(dest);
341+
dest.push(property.clone());
342+
return true
343+
}
337344

338345
false
339346
}
@@ -342,7 +349,7 @@ impl PropertyHandler for DisplayHandler {
342349
if self.display.is_none() {
343350
return
344351
}
345-
352+
346353
dest.extend(&mut self.decls);
347354

348355
if let Some(display) = std::mem::take(&mut self.display) {

0 commit comments

Comments
 (0)