mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-22 10:19:20 +00:00
Bindings: Implement is_supported_property_index in terms of item_value
Greatly simplifying the code :^)
This commit is contained in:
parent
c5c1a8fcc7
commit
9b1af542e7
Notes:
github-actions[bot]
2024-07-26 12:27:15 +00:00
Author: https://github.com/shannonbooth
Commit: 9b1af542e7
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/827
34 changed files with 4 additions and 138 deletions
|
@ -48,15 +48,10 @@ void MediaList::set_media_text(StringView text)
|
|||
m_media = parse_media_query_list(Parser::ParsingContext { realm() }, text);
|
||||
}
|
||||
|
||||
bool MediaList::is_supported_property_index(u32 index) const
|
||||
{
|
||||
return index < length();
|
||||
}
|
||||
|
||||
// https://www.w3.org/TR/cssom-1/#dom-medialist-item
|
||||
Optional<String> MediaList::item(u32 index) const
|
||||
{
|
||||
if (!is_supported_property_index(index))
|
||||
if (index >= m_media.size())
|
||||
return {};
|
||||
|
||||
return m_media[index]->to_string();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue