diff --git a/Userland/Libraries/LibWeb/DOM/HTMLCollection.cpp b/Userland/Libraries/LibWeb/DOM/HTMLCollection.cpp
index 31365c55301..d7d5b3af0b1 100644
--- a/Userland/Libraries/LibWeb/DOM/HTMLCollection.cpp
+++ b/Userland/Libraries/LibWeb/DOM/HTMLCollection.cpp
@@ -158,14 +158,14 @@ WebIDL::ExceptionOr HTMLCollection::item_value(size_t index) const
auto* element = item(index);
if (!element)
return JS::js_undefined();
- return const_cast(element);
+ return element;
}
-WebIDL::ExceptionOr HTMLCollection::named_item_value(FlyString const& index) const
+WebIDL::ExceptionOr HTMLCollection::named_item_value(FlyString const& name) const
{
- auto* element = named_item(index);
+ auto* element = named_item(name);
if (!element)
return JS::js_undefined();
- return const_cast(element);
+ return element;
}
}