diff --git a/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.cpp
index 0f7c9d24a1..a8b14681ab 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.cpp
@@ -105,32 +105,37 @@ Optional HTMLAnchorElement::default_role() const
}
// https://html.spec.whatwg.org/multipage/text-level-semantics.html#dom-a-text
-DeprecatedString HTMLAnchorElement::text() const
+String HTMLAnchorElement::text() const
{
// The text attribute's getter must return this element's descendant text content.
- return descendant_text_content();
+ return MUST(String::from_deprecated_string(descendant_text_content()));
}
// https://html.spec.whatwg.org/multipage/text-level-semantics.html#dom-a-text
-void HTMLAnchorElement::set_text(DeprecatedString const& text)
+void HTMLAnchorElement::set_text(String const& text)
{
// The text attribute's setter must string replace all with the given value within this element.
- string_replace_all(text);
+ string_replace_all(text.to_deprecated_string());
}
// https://html.spec.whatwg.org/multipage/text-level-semantics.html#dom-a-referrerpolicy
-DeprecatedString HTMLAnchorElement::referrer_policy() const
+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 policy_string = deprecated_attribute(HTML::AttributeNames::referrerpolicy);
- auto maybe_policy = ReferrerPolicy::from_string(policy_string);
- if (maybe_policy.has_value())
- return ReferrerPolicy::to_string(maybe_policy.value());
- return "";
+ 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 HTMLAnchorElement::set_referrer_policy(DeprecatedString const& referrer_policy)
+WebIDL::ExceptionOr 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);
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.h b/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.h
index 360d1da808..bd27729a45 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.h
+++ b/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.h
@@ -23,11 +23,11 @@ public:
DeprecatedString target() const { return deprecated_attribute(HTML::AttributeNames::target); }
DeprecatedString download() const { return deprecated_attribute(HTML::AttributeNames::download); }
- DeprecatedString text() const;
- void set_text(DeprecatedString const&);
+ String text() const;
+ void set_text(String const&);
- DeprecatedString referrer_policy() const;
- WebIDL::ExceptionOr set_referrer_policy(DeprecatedString const&);
+ StringView referrer_policy() const;
+ WebIDL::ExceptionOr set_referrer_policy(String const&);
// ^EventTarget
// https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute:the-a-element
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.idl
index 0ede1cc10c..f9f269173b 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.idl
+++ b/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.idl
@@ -2,7 +2,7 @@
#import
// https://html.spec.whatwg.org/multipage/text-level-semantics.html#htmlanchorelement
-[Exposed=Window, UseDeprecatedAKString]
+[Exposed=Window]
interface HTMLAnchorElement : HTMLElement {
[HTMLConstructor] constructor();