LibWeb: Added HTMLLinkElement.as

This commit is contained in:
Hexeption 2024-06-04 08:04:44 +01:00 committed by Andreas Kling
parent 4b3e26c583
commit 2f4668edce
Notes: sideshowbarker 2024-07-17 22:41:14 +09:00
5 changed files with 48 additions and 1 deletions

View file

@ -90,6 +90,29 @@ void HTMLLinkElement::inserted()
}
}
// https://html.spec.whatwg.org/multipage/semantics.html#dom-link-as
String HTMLLinkElement::as() const
{
String attribute_value = get_attribute_value(HTML::AttributeNames::as);
if (attribute_value.equals_ignoring_ascii_case("fetch"sv) ||
attribute_value.equals_ignoring_ascii_case("image"sv) ||
attribute_value.equals_ignoring_ascii_case("script"sv) ||
attribute_value.equals_ignoring_ascii_case("style"sv) ||
attribute_value.equals_ignoring_ascii_case("video"sv) ||
attribute_value.equals_ignoring_ascii_case("audio"sv) ||
attribute_value.equals_ignoring_ascii_case("track"sv) ||
attribute_value.equals_ignoring_ascii_case("font"sv))
return attribute_value.to_lowercase().release_value();
return String {};
}
WebIDL::ExceptionOr<void> HTMLLinkElement::set_as(String const& value)
{
return set_attribute(HTML::AttributeNames::as, move(value));
}
// https://html.spec.whatwg.org/multipage/semantics.html#dom-link-rellist
JS::NonnullGCPtr<DOM::DOMTokenList> HTMLLinkElement::rel_list()
{