mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 12:05:15 +00:00
LibWeb: Handle empty inputs to the CSS parser
Empty inputs -> empty outputs.
This commit is contained in:
parent
86098505ec
commit
d0312f6208
Notes:
sideshowbarker
2024-07-19 05:25:08 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/d0312f6208c
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
Reference in a new issue