mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-09 12:42:54 +00:00
LibHTML: Handle stand-alone attribute selectors
A selector like "[foo]" is now parsed as a universal selector component with an attribute match type. Pretty neat :^)
This commit is contained in:
parent
c02f560f73
commit
61ba19f031
Notes:
sideshowbarker
2024-07-19 11:07:17 +09:00
Author: https://github.com/awesomekling
Commit: 61ba19f031
2 changed files with 13 additions and 4 deletions
|
@ -244,14 +244,18 @@ public:
|
|||
} else if (peek() == '#') {
|
||||
type = Selector::Component::Type::Id;
|
||||
consume_one();
|
||||
} else {
|
||||
} else if (isalpha(peek())) {
|
||||
type = Selector::Component::Type::TagName;
|
||||
} else {
|
||||
type = Selector::Component::Type::Universal;
|
||||
}
|
||||
|
||||
while (is_valid_selector_char(peek()))
|
||||
buffer.append(consume_one());
|
||||
if (type != Selector::Component::Type::Universal) {
|
||||
while (is_valid_selector_char(peek()))
|
||||
buffer.append(consume_one());
|
||||
PARSE_ASSERT(!buffer.is_null());
|
||||
}
|
||||
|
||||
PARSE_ASSERT(!buffer.is_null());
|
||||
Selector::Component component {
|
||||
type,
|
||||
Selector::Component::PseudoClass::None,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue