diff --git a/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp
index 3bec245aac..ad1180bc47 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp
@@ -42,6 +42,27 @@ JS::GCPtr const& HTMLSelectElement::options()
return m_options;
}
+// https://html.spec.whatwg.org/multipage/form-elements.html#dom-select-length
+size_t 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(*options()).length();
+}
+
+// https://html.spec.whatwg.org/multipage/form-elements.html#dom-select-item
+DOM::Element* HTMLSelectElement::item(size_t index)
+{
+ // The item(index) method must return the value returned by the method of the same name on the options collection, when invoked with the same argument.
+ return const_cast(*options()).item(index);
+}
+
+// https://html.spec.whatwg.org/multipage/form-elements.html#dom-select-nameditem
+DOM::Element* HTMLSelectElement::named_item(FlyString const& name)
+{
+ // The namedItem(name) method must return the value returned by the method of the same name on the options collection, when invoked with the same argument.
+ return const_cast(*options()).named_item(name);
+}
+
// https://html.spec.whatwg.org/multipage/form-elements.html#dom-select-add
WebIDL::ExceptionOr HTMLSelectElement::add(HTMLOptionOrOptGroupElement element, Optional before)
{
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.h b/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.h
index 3e66c8d176..43209d5b7b 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.h
+++ b/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.h
@@ -25,6 +25,9 @@ public:
JS::GCPtr const& options();
+ size_t length();
+ DOM::Element* item(size_t index);
+ DOM::Element* named_item(FlyString const& name);
WebIDL::ExceptionOr add(HTMLOptionOrOptGroupElement element, Optional before = {});
int selected_index() const;
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.idl
index 1aa0bcd9ac..c1a1297d64 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.idl
+++ b/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.idl
@@ -10,6 +10,9 @@ interface HTMLSelectElement : HTMLElement {
[Reflect] attribute boolean required;
[SameObject] readonly attribute HTMLOptionsCollection options;
+ readonly attribute unsigned long length;
+ getter Element? item(unsigned long index);
+ getter Element? namedItem(DOMString name);
[CEReactions] undefined add((HTMLOptionElement or HTMLOptGroupElement) element, optional (HTMLElement or long)? before = null);
attribute long selectedIndex;