mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-04 10:18:51 +00:00
LibWeb: Implement the HTMLAreaElement.relList
attribute
This returns a DOMTokenList that reflects the `rel` attribute.
This commit is contained in:
parent
b7fd39c2e6
commit
0a3e1846f0
Notes:
sideshowbarker
2024-07-17 02:29:45 +09:00
Author: https://github.com/tcl3
Commit: 0a3e1846f0
Pull-request: https://github.com/SerenityOS/serenity/pull/24342
5 changed files with 24 additions and 1 deletions
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include <LibWeb/ARIA/Roles.h>
|
||||
#include <LibWeb/Bindings/HTMLAreaElementPrototype.h>
|
||||
#include <LibWeb/DOM/DOMTokenList.h>
|
||||
#include <LibWeb/HTML/HTMLAreaElement.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
|
||||
|
@ -31,9 +32,21 @@ void HTMLAreaElement::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 {}));
|
||||
}
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/image-maps.html#dom-area-rellist
|
||||
JS::GCPtr<DOM::DOMTokenList> HTMLAreaElement::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;
|
||||
}
|
||||
|
||||
Optional<String> HTMLAreaElement::hyperlink_element_utils_href() const
|
||||
{
|
||||
return attribute(HTML::AttributeNames::href);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue