mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:38:11 +00:00
LibWeb: Handle empty inputs to the CSS parser
Empty inputs -> empty outputs.
This commit is contained in:
parent
86098505ec
commit
d0312f6208
1 changed files with 4 additions and 0 deletions
|
@ -859,12 +859,16 @@ Optional<Selector> parse_selector(const StringView& selector_text)
|
|||
|
||||
RefPtr<StyleSheet> parse_css(const StringView& css)
|
||||
{
|
||||
if (css.is_empty())
|
||||
return StyleSheet::create({});
|
||||
CSSParser parser(css);
|
||||
return parser.parse_sheet();
|
||||
}
|
||||
|
||||
RefPtr<StyleDeclaration> parse_css_declaration(const StringView& css)
|
||||
{
|
||||
if (css.is_empty())
|
||||
return StyleDeclaration::create({});
|
||||
CSSParser parser(css);
|
||||
return parser.parse_standalone_declaration();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue