mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-28 04:08:08 +00:00
LibWeb: Use Reflect for HTMLAnchorElement.referrerPolicy
This commit is contained in:
committed by
Andreas Kling
parent
53d7aa53a2
commit
469cbe78de
@@ -156,27 +156,4 @@ void HTMLAnchorElement::set_text(String const& text)
|
||||
string_replace_all(text);
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/text-level-semantics.html#dom-a-referrerpolicy
|
||||
StringView HTMLAnchorElement::referrer_policy() const
|
||||
{
|
||||
// FIXME: This should probably be `Reflect` in the IDL.
|
||||
// The IDL attribute referrerPolicy must reflect the referrerpolicy content attribute, limited to only known values.
|
||||
auto maybe_policy_string = attribute(HTML::AttributeNames::referrerpolicy);
|
||||
if (!maybe_policy_string.has_value())
|
||||
return ""sv;
|
||||
|
||||
auto maybe_policy = ReferrerPolicy::from_string(maybe_policy_string.value());
|
||||
if (!maybe_policy.has_value())
|
||||
return ""sv;
|
||||
|
||||
return ReferrerPolicy::to_string(maybe_policy.value());
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/text-level-semantics.html#dom-a-referrerpolicy
|
||||
WebIDL::ExceptionOr<void> HTMLAnchorElement::set_referrer_policy(String const& referrer_policy)
|
||||
{
|
||||
// The IDL attribute referrerPolicy must reflect the referrerpolicy content attribute, limited to only known values.
|
||||
return set_attribute(HTML::AttributeNames::referrerpolicy, referrer_policy);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user