mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
LibWeb: Update DOMStringList to match PlatformObject changes
- is_supported_property_index() no longer needs to be overridden - item_value() now returns Optional
This commit is contained in:
parent
06484d0663
commit
2a55ab13ef
Notes:
github-actions[bot]
2024-07-29 10:17:56 +00:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/LadybirdBrowser/ladybird/commit/2a55ab13ef9 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/883
2 changed files with 3 additions and 11 deletions
|
@ -56,17 +56,10 @@ bool DOMStringList::contains(StringView string)
|
||||||
return m_list.contains_slow(string);
|
return m_list.contains_slow(string);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DOMStringList::is_supported_property_index(u32 index) const
|
Optional<JS::Value> DOMStringList::item_value(size_t index) const
|
||||||
{
|
|
||||||
// The DOMStringList interface supports indexed properties. The supported property indices are the indices of this's
|
|
||||||
// associated list.
|
|
||||||
return index < m_list.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
WebIDL::ExceptionOr<JS::Value> DOMStringList::item_value(size_t index) const
|
|
||||||
{
|
{
|
||||||
if (index + 1 > m_list.size())
|
if (index + 1 > m_list.size())
|
||||||
return JS::js_undefined();
|
return {};
|
||||||
|
|
||||||
return JS::PrimitiveString::create(vm(), m_list.at(index));
|
return JS::PrimitiveString::create(vm(), m_list.at(index));
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,8 +22,7 @@ public:
|
||||||
Optional<String> item(u32 index) const;
|
Optional<String> item(u32 index) const;
|
||||||
bool contains(StringView string);
|
bool contains(StringView string);
|
||||||
|
|
||||||
virtual bool is_supported_property_index(u32) const override;
|
virtual Optional<JS::Value> item_value(size_t index) const override;
|
||||||
virtual WebIDL::ExceptionOr<JS::Value> item_value(size_t index) const override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
explicit DOMStringList(JS::Realm&, Vector<String>);
|
explicit DOMStringList(JS::Realm&, Vector<String>);
|
||||||
|
|
Loading…
Reference in a new issue