LibWeb: Align StyleSheet title getter with the specification

The CSSOM specification says that StyleSheet.title should return null
if the title field is empty.
This commit is contained in:
Tim Ledbetter 2024-04-28 14:32:52 +01:00 committed by Andreas Kling
commit 84193f2746
Notes: sideshowbarker 2024-07-17 06:28:38 +09:00
6 changed files with 22 additions and 13 deletions

View file

@ -36,4 +36,14 @@ void StyleSheet::set_parent_css_style_sheet(CSSStyleSheet* parent)
m_parent_style_sheet = parent;
}
// https://drafts.csswg.org/cssom/#dom-stylesheet-title
Optional<String> StyleSheet::title_for_bindings() const
{
// The title attribute must return the title or null if title is the empty string.
if (m_title.is_empty())
return {};
return m_title;
}
}