diff --git a/Base/home/anon/www/attrselectors.html b/Base/home/anon/www/attrselectors.html index dd36f17093..f1fd66626c 100644 --- a/Base/home/anon/www/attrselectors.html +++ b/Base/home/anon/www/attrselectors.html @@ -2,6 +2,10 @@ CSS attribute selector test +
This div is hello, friends!
This div has id="foo" and is bloo!
This div has a "cool" attribute and a cool green color.
diff --git a/Libraries/LibHTML/Parser/CSSParser.cpp b/Libraries/LibHTML/Parser/CSSParser.cpp index b3d49bff91..4b25035c54 100644 --- a/Libraries/LibHTML/Parser/CSSParser.cpp +++ b/Libraries/LibHTML/Parser/CSSParser.cpp @@ -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,