diff --git a/Tests/LibWeb/Text/expected/HTML/relList-attribute.txt b/Tests/LibWeb/Text/expected/HTML/relList-attribute.txt
new file mode 100644
index 00000000000..a8f13589868
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/HTML/relList-attribute.txt
@@ -0,0 +1,6 @@
+a.relList initial length: 0
+a.relList always returns the same value: true
+a.relList for after setting rel to "whatever": whatever
+a.relList for after setting rel to "prefetch": prefetch
+a.relList contains "prefetch": true
+a.relList contains "whatever": false
diff --git a/Tests/LibWeb/Text/input/HTML/relList-attribute.html b/Tests/LibWeb/Text/input/HTML/relList-attribute.html
new file mode 100644
index 00000000000..3ccbe06a7ef
--- /dev/null
+++ b/Tests/LibWeb/Text/input/HTML/relList-attribute.html
@@ -0,0 +1,26 @@
+
+
+
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.cpp
index ce91870048d..ec76b90ae61 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.cpp
@@ -7,6 +7,7 @@
#include
#include
+#include
#include
#include
#include
@@ -38,6 +39,9 @@ void HTMLAnchorElement::attribute_changed(FlyString const& name, Optionalassociated_attribute_changed(value.value_or(String {}));
}
}
@@ -123,6 +127,15 @@ Optional HTMLAnchorElement::default_role() const
return ARIA::Role::generic;
}
+// https://html.spec.whatwg.org/multipage/text-level-semantics.html#dom-a-rellist
+JS::GCPtr HTMLAnchorElement::rel_list()
+{
+ // The IDL attribute relList must reflect the rel content attribute.
+ if (!m_rel_list)
+ m_rel_list = DOM::DOMTokenList::create(*this, HTML::AttributeNames::rel);
+ return m_rel_list;
+}
+
// https://html.spec.whatwg.org/multipage/text-level-semantics.html#dom-a-text
String HTMLAnchorElement::text() const
{
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.h b/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.h
index a7d94b7a1be..825a7b65eea 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.h
+++ b/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.h
@@ -24,6 +24,8 @@ public:
String target() const { return get_attribute_value(HTML::AttributeNames::target); }
String download() const { return get_attribute_value(HTML::AttributeNames::download); }
+ JS::GCPtr rel_list();
+
String text() const;
void set_text(String const&);
@@ -68,6 +70,8 @@ private:
}
virtual Optional default_role() const override;
+
+ JS::GCPtr m_rel_list;
};
}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.idl
index f9f269173b6..9bc44f7971a 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.idl
+++ b/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.idl
@@ -11,7 +11,7 @@ interface HTMLAnchorElement : HTMLElement {
[CEReactions, Reflect] attribute DOMString download;
[CEReactions, Reflect] attribute DOMString ping;
[CEReactions, Reflect] attribute DOMString rel;
- // FIXME: [SameObject, PutForwards=value] readonly attribute DOMTokenList relList;
+ [SameObject, PutForwards=value] readonly attribute DOMTokenList relList;
[CEReactions, Reflect] attribute DOMString hreflang;
[CEReactions, Reflect] attribute DOMString type;