Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(css/parser): Add legacy_ie to the ParserConfig #7109

Merged
merged 9 commits into from Mar 27, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions crates/swc_css_parser/src/parser/mod.rs
Expand Up @@ -47,6 +47,10 @@ pub struct ParserConfig {
/// Defaults to `false`.
#[serde(default)]
pub legacy_nesting: bool,

/// If this is `true`, the legacy syntax for IE will be parsed.
#[serde(default)]
pub legacy_ie: bool,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
Expand Down
2 changes: 1 addition & 1 deletion crates/swc_css_parser/src/parser/values_and_units/mod.rs
Expand Up @@ -1704,7 +1704,7 @@ where
let value = match self.try_parse(|p| p.parse_generic_value()) {
Some(v) => v,
None => {
if is_one_of!(self, ";", ":") {
if is_one_of!(self, ";", ":") || (self.config.legacy_ie && is!(self, "=")) {
let tok = self.input.bump().unwrap();

ComponentValue::PreservedToken(Box::new(tok))
Expand Down
4 changes: 4 additions & 0 deletions crates/swc_css_parser/tests/fixture/turbo/4092/input.css
@@ -0,0 +1,4 @@
.carousel .control-dots .dot.selected, .carousel .control-dots .dot:hover {
opacity: 1;
filter: alpha(opacity=100);
kdy1 marked this conversation as resolved.
Show resolved Hide resolved
}