diff --git a/Libraries/LibWeb/HTML/HTMLOListElement.cpp b/Libraries/LibWeb/HTML/HTMLOListElement.cpp
index c8b730051ff..7079afdea11 100644
--- a/Libraries/LibWeb/HTML/HTMLOListElement.cpp
+++ b/Libraries/LibWeb/HTML/HTMLOListElement.cpp
@@ -7,6 +7,7 @@
#include
#include
#include
+#include
namespace Web::HTML {
@@ -25,4 +26,14 @@ void HTMLOListElement::initialize(JS::Realm& realm)
WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLOListElement);
}
+// https://html.spec.whatwg.org/multipage/grouping-content.html#dom-ol-start
+WebIDL::Long HTMLOListElement::start()
+{
+ // The start IDL attribute must reflect the content attribute of the same name, with a default value of 1.
+ auto content_attribute_value = get_attribute(AttributeNames::start).value_or("1"_string);
+ if (auto maybe_number = HTML::parse_integer(content_attribute_value); maybe_number.has_value())
+ return *maybe_number;
+ return 1;
+}
+
}
diff --git a/Libraries/LibWeb/HTML/HTMLOListElement.h b/Libraries/LibWeb/HTML/HTMLOListElement.h
index f128f86343b..a89a25308c3 100644
--- a/Libraries/LibWeb/HTML/HTMLOListElement.h
+++ b/Libraries/LibWeb/HTML/HTMLOListElement.h
@@ -8,6 +8,7 @@
#include
#include
+#include
namespace Web::HTML {
@@ -21,8 +22,8 @@ public:
// https://www.w3.org/TR/html-aria/#el-ol
virtual Optional default_role() const override { return ARIA::Role::list; }
- i32 start() { return get_attribute(AttributeNames::start).value_or("1"_string).to_number().value_or(1); }
- void set_start(i32 start)
+ WebIDL::Long start();
+ void set_start(WebIDL::Long start)
{
set_attribute(AttributeNames::start, String::number(start)).release_value_but_fixme_should_propagate_errors();
}