diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp
index f60b98c39d..94dc1c13f3 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp
@@ -465,9 +465,10 @@ ErrorOr HTMLFormElement::populate_vector_with_submittable_elements_in_tree
}
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#dom-fs-method
-DeprecatedString HTMLFormElement::method() const
+StringView HTMLFormElement::method() const
{
// The method and enctype IDL attributes must reflect the respective content attributes of the same name, limited to only known values.
+ // FIXME: This should probably be `Reflect` in the IDL.
auto method_state = method_state_from_form_element(*this);
switch (method_state) {
case MethodAttributeState::GET:
@@ -476,36 +477,35 @@ DeprecatedString HTMLFormElement::method() const
return "post"sv;
case MethodAttributeState::Dialog:
return "dialog"sv;
- default:
- VERIFY_NOT_REACHED();
}
+ VERIFY_NOT_REACHED();
}
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#dom-fs-method
-WebIDL::ExceptionOr HTMLFormElement::set_method(DeprecatedString const& method)
+WebIDL::ExceptionOr HTMLFormElement::set_method(String const& method)
{
// The method and enctype IDL attributes must reflect the respective content attributes of the same name, limited to only known values.
return set_attribute(AttributeNames::method, method);
}
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#dom-fs-action
-DeprecatedString HTMLFormElement::action() const
+String HTMLFormElement::action() const
{
// The action IDL attribute must reflect the content attribute of the same name, except that on getting, when the
// content attribute is missing or its value is the empty string, the element's node document's URL must be returned
// instead.
if (!has_attribute(AttributeNames::action))
- return document().url_string();
+ return MUST(document().url().to_string());
- auto action_attribute = deprecated_attribute(AttributeNames::action);
- if (action_attribute.is_empty())
- return document().url_string();
+ auto action_attribute = attribute(AttributeNames::action);
+ if (!action_attribute.has_value() || action_attribute->is_empty())
+ return MUST(document().url().to_string());
- return action_attribute;
+ return action_attribute.value();
}
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#dom-fs-action
-WebIDL::ExceptionOr HTMLFormElement::set_action(DeprecatedString const& value)
+WebIDL::ExceptionOr HTMLFormElement::set_action(String const& value)
{
return set_attribute(AttributeNames::action, value);
}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFormElement.h b/Userland/Libraries/LibWeb/HTML/HTMLFormElement.h
index 204413a0f8..3d6c196e14 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLFormElement.h
+++ b/Userland/Libraries/LibWeb/HTML/HTMLFormElement.h
@@ -80,11 +80,11 @@ public:
bool constructing_entry_list() const { return m_constructing_entry_list; }
void set_constructing_entry_list(bool value) { m_constructing_entry_list = value; }
- DeprecatedString method() const;
- WebIDL::ExceptionOr set_method(DeprecatedString const&);
+ StringView method() const;
+ WebIDL::ExceptionOr set_method(String const&);
- DeprecatedString action() const;
- WebIDL::ExceptionOr set_action(DeprecatedString const&);
+ String action() const;
+ WebIDL::ExceptionOr set_action(String const&);
private:
HTMLFormElement(DOM::Document&, DOM::QualifiedName);
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFormElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLFormElement.idl
index a7c23f06ea..30b95985e9 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLFormElement.idl
+++ b/Userland/Libraries/LibWeb/HTML/HTMLFormElement.idl
@@ -2,7 +2,7 @@
#import
// https://html.spec.whatwg.org/multipage/semantics.html#htmlformelement
-[Exposed=Window, UseDeprecatedAKString]
+[Exposed=Window]
interface HTMLFormElement : HTMLElement {
[HTMLConstructor] constructor();