mirror of
https://github.com/RGBCube/serenity
synced 2025-05-20 18:05:07 +00:00
LibWeb: Use a switch-statement on the delimiter for MatchType selection
... in Parser::parse_simple_selector
This commit is contained in:
parent
19cca57f8a
commit
397d8b4aca
1 changed files with 12 additions and 7 deletions
|
@ -423,18 +423,23 @@ Result<Selector::SimpleSelector, Parser::ParsingResult> Parser::parse_simple_sel
|
|||
dbgln_if(CSS_PARSER_DEBUG, "Expected a double delim for attribute comparison, got: '{}{}'", delim_part.to_debug_string(), delim_second_part.to_debug_string());
|
||||
return ParsingResult::SyntaxError;
|
||||
}
|
||||
|
||||
if (delim_part.token().delim() == '~') {
|
||||
switch (delim_part.token().delim()) {
|
||||
case '~':
|
||||
simple_selector.attribute.match_type = Selector::SimpleSelector::Attribute::MatchType::ContainsWord;
|
||||
} else if (delim_part.token().delim() == '*') {
|
||||
break;
|
||||
case '*':
|
||||
simple_selector.attribute.match_type = Selector::SimpleSelector::Attribute::MatchType::ContainsString;
|
||||
} else if (delim_part.token().delim() == '|') {
|
||||
break;
|
||||
case '|':
|
||||
simple_selector.attribute.match_type = Selector::SimpleSelector::Attribute::MatchType::StartsWithSegment;
|
||||
} else if (delim_part.token().delim() == '^') {
|
||||
break;
|
||||
case '^':
|
||||
simple_selector.attribute.match_type = Selector::SimpleSelector::Attribute::MatchType::StartsWithString;
|
||||
} else if (delim_part.token().delim() == '$') {
|
||||
break;
|
||||
case '$':
|
||||
simple_selector.attribute.match_type = Selector::SimpleSelector::Attribute::MatchType::EndsWithString;
|
||||
} else {
|
||||
break;
|
||||
default:
|
||||
attribute_tokens.reconsume_current_input_token();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue