Skip to content

Commit 28d7794

Browse files
Allow @property to be nested inside at-rules (parcel-bundler#1090)
1 parent 220b390 commit 28d7794

File tree

2 files changed

+42
-4
lines changed

2 files changed

+42
-4
lines changed

src/lib.rs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28748,6 +28748,44 @@ mod tests {
2874828748
"#,
2874928749
"@property --property-name{syntax:\"<color>\";inherits:true;initial-value:#00f}.foo{color:var(--property-name)}",
2875028750
);
28751+
28752+
test(
28753+
r#"
28754+
@media (width < 800px) {
28755+
@property --property-name {
28756+
syntax: '*';
28757+
inherits: false;
28758+
}
28759+
}
28760+
"#,
28761+
indoc! {r#"
28762+
@media (width < 800px) {
28763+
@property --property-name {
28764+
syntax: "*";
28765+
inherits: false
28766+
}
28767+
}
28768+
"#},
28769+
);
28770+
28771+
test(
28772+
r#"
28773+
@layer foo {
28774+
@property --property-name {
28775+
syntax: '*';
28776+
inherits: false;
28777+
}
28778+
}
28779+
"#,
28780+
indoc! {r#"
28781+
@layer foo {
28782+
@property --property-name {
28783+
syntax: "*";
28784+
inherits: false
28785+
}
28786+
}
28787+
"#},
28788+
);
2875128789
}
2875228790

2875328791
#[test]

src/parser.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -320,10 +320,6 @@ impl<'a, 'o, 'i, T: crate::traits::AtRuleParser<'i>> AtRuleParser<'i> for TopLev
320320
let media = MediaList::parse(input, &self.options)?;
321321
return Ok(AtRulePrelude::CustomMedia(name, media))
322322
},
323-
"property" => {
324-
let name = DashedIdent::parse(input)?;
325-
return Ok(AtRulePrelude::Property(name))
326-
},
327323
_ => {}
328324
}
329325

@@ -695,6 +691,10 @@ impl<'a, 'o, 'b, 'i, T: crate::traits::AtRuleParser<'i>> AtRuleParser<'i> for Ne
695691
return Err(input.new_custom_error(ParserError::DeprecatedCssModulesValueRule));
696692
},
697693

694+
"property" => {
695+
let name = DashedIdent::parse(input)?;
696+
return Ok(AtRulePrelude::Property(name))
697+
},
698698

699699
_ => parse_custom_at_rule_prelude(&name, input, self.options, self.at_rule_parser)?
700700
};

0 commit comments

Comments
 (0)