mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +00:00
LibWeb: Use Reflect for HTMLAnchorElement.referrerPolicy
This commit is contained in:
parent
53d7aa53a2
commit
469cbe78de
Notes:
sideshowbarker
2024-07-16 22:14:49 +09:00
Author: https://github.com/jamierocks
Commit: 469cbe78de
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/23
3 changed files with 2 additions and 27 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue