diff --git a/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp
index 1bdb269895..60691c8907 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp
@@ -90,6 +90,20 @@ Vector> HTMLSelectElement::list_of_options() const
return list;
}
+// https://html.spec.whatwg.org/multipage/form-elements.html#the-select-element:concept-form-reset-control
+void HTMLSelectElement::reset_algorithm()
+{
+ // The reset algorithm for select elements is to go through all the option elements in the element's list of options,
+ for (auto const& option_element : list_of_options()) {
+ // set their selectedness to true if the option element has a selected attribute, and false otherwise,
+ option_element->m_selected = option_element->has_attribute(AttributeNames::selected);
+ // set their dirtiness to false,
+ option_element->m_dirty = false;
+ // and then have the option elements ask for a reset.
+ option_element->ask_for_a_reset();
+ }
+}
+
// https://html.spec.whatwg.org/multipage/form-elements.html#dom-select-selectedindex
int HTMLSelectElement::selected_index() const
{
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.h b/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.h
index 3f5bc41094..64288d1c24 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.h
+++ b/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.h
@@ -56,6 +56,8 @@ public:
// https://html.spec.whatwg.org/multipage/forms.html#category-label
virtual bool is_labelable() const override { return true; }
+ virtual void reset_algorithm() override;
+
DeprecatedString const& type() const;
private: