mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-26 11:20:03 +00:00
LibWeb: Implement the HTMLAnchorElement.relList attribute
This returns a DOMTokenList that reflects the `rel` attribute.
This commit is contained in:
committed by
Andreas Kling
parent
63246577d2
commit
b7fd39c2e6
@@ -7,6 +7,7 @@
|
||||
|
||||
#include <LibWeb/ARIA/Roles.h>
|
||||
#include <LibWeb/Bindings/HTMLAnchorElementPrototype.h>
|
||||
#include <LibWeb/DOM/DOMTokenList.h>
|
||||
#include <LibWeb/DOM/Event.h>
|
||||
#include <LibWeb/HTML/AttributeNames.h>
|
||||
#include <LibWeb/HTML/HTMLAnchorElement.h>
|
||||
@@ -38,6 +39,9 @@ void HTMLAnchorElement::attribute_changed(FlyString const& name, Optional<String
|
||||
HTMLElement::attribute_changed(name, value);
|
||||
if (name == HTML::AttributeNames::href) {
|
||||
set_the_url();
|
||||
} else if (name == HTML::AttributeNames::rel) {
|
||||
if (m_rel_list)
|
||||
m_rel_list->associated_attribute_changed(value.value_or(String {}));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,6 +127,15 @@ Optional<ARIA::Role> HTMLAnchorElement::default_role() const
|
||||
return ARIA::Role::generic;
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/text-level-semantics.html#dom-a-rellist
|
||||
JS::GCPtr<DOM::DOMTokenList> 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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user