1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 21:08:12 +00:00

LibWeb: Parse unknown media type in media queries

Prevent media query parser from falling back into
MediaQuery::create_not_all() for queries with unknown media type.
With this change following test works correctly:
http://wpt.live/css/css-conditional/at-media-001.html
This commit is contained in:
Aliaksandr Kalenik 2022-11-03 08:58:27 +03:00 committed by Sam Atkins
parent 7f527ddde3
commit 2675b9390b
3 changed files with 11 additions and 9 deletions

View file

@ -1142,13 +1142,10 @@ Optional<MediaQuery::MediaType> Parser::parse_media_type(TokenStream<ComponentVa
if (!token.is(Token::Type::Ident))
return {};
auto ident = token.token().ident();
if (auto media_type = media_type_from_string(ident); media_type.has_value()) {
transaction.commit();
return media_type.release_value();
}
transaction.commit();
return {};
auto ident = token.token().ident();
return media_type_from_string(ident);
}
// `<media-in-parens>`, https://www.w3.org/TR/mediaqueries-4/#typedef-media-in-parens