mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-05 01:42:54 +00:00
LibWeb: Add select and option collection set length
This commit is contained in:
parent
4e5ce7b63e
commit
5c277144d8
Notes:
sideshowbarker
2024-07-16 23:17:55 +09:00
Author: https://github.com/bplaat
Commit: 5c277144d8
Pull-request: https://github.com/SerenityOS/serenity/pull/23895
Reviewed-by: https://github.com/shannonbooth
8 changed files with 95 additions and 5 deletions
|
@ -100,12 +100,18 @@ JS::GCPtr<HTMLOptionsCollection> const& HTMLSelectElement::options()
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/form-elements.html#dom-select-length
|
||||
size_t HTMLSelectElement::length()
|
||||
WebIDL::UnsignedLong HTMLSelectElement::length()
|
||||
{
|
||||
// The length IDL attribute must return the number of nodes represented by the options collection. On setting, it must act like the attribute of the same name on the options collection.
|
||||
return const_cast<HTMLOptionsCollection&>(*options()).length();
|
||||
}
|
||||
|
||||
WebIDL::ExceptionOr<void> HTMLSelectElement::set_length(WebIDL::UnsignedLong length)
|
||||
{
|
||||
// On setting, it must act like the attribute of the same name on the options collection.
|
||||
return const_cast<HTMLOptionsCollection&>(*options()).set_length(length);
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/form-elements.html#dom-select-item
|
||||
DOM::Element* HTMLSelectElement::item(size_t index)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue