diff --git a/Userland/Libraries/LibWeb/DOM/HTMLCollection.cpp b/Userland/Libraries/LibWeb/DOM/HTMLCollection.cpp
index 9eb8d5dd7f..d61fe9da0a 100644
--- a/Userland/Libraries/LibWeb/DOM/HTMLCollection.cpp
+++ b/Userland/Libraries/LibWeb/DOM/HTMLCollection.cpp
@@ -60,7 +60,7 @@ JS::MarkedVector HTMLCollection::collect_matching_elements() const
}
// https://dom.spec.whatwg.org/#dom-htmlcollection-length
-size_t HTMLCollection::length()
+size_t HTMLCollection::length() const
{
// The length getter steps are to return the number of nodes represented by the collection.
return collect_matching_elements().size();
diff --git a/Userland/Libraries/LibWeb/DOM/HTMLCollection.h b/Userland/Libraries/LibWeb/DOM/HTMLCollection.h
index 49faad306f..4d1d332525 100644
--- a/Userland/Libraries/LibWeb/DOM/HTMLCollection.h
+++ b/Userland/Libraries/LibWeb/DOM/HTMLCollection.h
@@ -38,7 +38,7 @@ public:
virtual ~HTMLCollection() override;
- size_t length();
+ size_t length() const;
Element* item(size_t index) const;
Element* named_item(DeprecatedFlyString const& name) const;