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): Support @starting-style #7677

Merged
merged 3 commits into from
Jul 20, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions crates/swc_atoms/words.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2213,6 +2213,7 @@ src
srcdoc
srcset
start
starting-style
startOffset
startoffset
static
Expand Down
18 changes: 18 additions & 0 deletions crates/swc_css_parser/src/parser/at_rules/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,17 @@ where

None
}
js_word!("starting-style") => {
self.input.skip_ws();

if !is!(self, EOF) {
let span = self.input.cur_span();

return Err(Error::new(span, ErrorKind::Expected("'{' token")));
}

None
}
_ => {
return Err(Error::new(Default::default(), ErrorKind::Ignore));
}
Expand Down Expand Up @@ -738,6 +749,13 @@ where

declaration_list
}
js_word!("starting-style") => {
let rule_list = self.parse_as::<Vec<Rule>>()?;
let rule_list: Vec<ComponentValue> =
rule_list.into_iter().map(ComponentValue::from).collect();

rule_list
}
_ => {
return Err(Error::new(Default::default(), ErrorKind::Ignore));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@starting-style {
h1 {
background-color: transparent;
}
@layer foo {
div {
height: 100px;
}
}
}
CGQAQ marked this conversation as resolved.
Show resolved Hide resolved