mirror of
https://github.com/swc-project/swc.git
synced 2024-10-05 04:39:06 +03:00
perf(css/parser): Use ascii operations (#5808)
**Description:** We don't need Unicode handling in these cases.
This commit is contained in:
parent
417b1f2a92
commit
96cc888ef2
@ -23,7 +23,7 @@ where
|
||||
unreachable!()
|
||||
}
|
||||
};
|
||||
let lowercased_name = &*at_keyword_name.0.to_lowercase();
|
||||
let lowercased_name = &*at_keyword_name.0.to_ascii_lowercase();
|
||||
let at_rule_name = if at_keyword_name.0.starts_with("--") {
|
||||
AtRuleName::DashedIdent(DashedIdent {
|
||||
span: Span::new(
|
||||
@ -1072,7 +1072,7 @@ where
|
||||
|
||||
Ok(SupportsFeature::Declaration(declaration))
|
||||
}
|
||||
Token::Function { value, .. } if &*value.to_lowercase() == "selector" => {
|
||||
Token::Function { value, .. } if &*value.to_ascii_lowercase() == "selector" => {
|
||||
// TODO improve me
|
||||
let ctx = Ctx {
|
||||
block_contents_grammar: BlockContentsGrammar::DeclarationValue,
|
||||
|
@ -326,7 +326,7 @@ where
|
||||
let mut is_legacy_syntax = true;
|
||||
|
||||
match cur!(self) {
|
||||
Token::Ident { value, .. } if &*value.to_lowercase() == "from" => {
|
||||
Token::Ident { value, .. } if &*value.to_ascii_lowercase() == "from" => {
|
||||
is_legacy_syntax = false;
|
||||
|
||||
values.push(ComponentValue::Ident(self.parse()?));
|
||||
@ -664,7 +664,8 @@ where
|
||||
|
||||
match cur!(self) {
|
||||
Token::Ident { value, .. }
|
||||
if &*value.to_lowercase() == "from" && function_name != "device-cmyk" =>
|
||||
if &*value.to_ascii_lowercase() == "from"
|
||||
&& function_name != "device-cmyk" =>
|
||||
{
|
||||
values.push(ComponentValue::Ident(self.parse()?));
|
||||
|
||||
@ -1011,7 +1012,7 @@ where
|
||||
self.input.skip_ws()?;
|
||||
|
||||
match cur!(self) {
|
||||
Token::Ident { value, .. } if &*value.to_lowercase() == "from" => {
|
||||
Token::Ident { value, .. } if &*value.to_ascii_lowercase() == "from" => {
|
||||
values.push(self.try_parse_variable_function(|parser| {
|
||||
Ok(ComponentValue::Ident(parser.parse()?))
|
||||
})?);
|
||||
|
Loading…
Reference in New Issue
Block a user