diff --git a/Userland/Libraries/LibWeb/HTML/FormControlInfrastructure.cpp b/Userland/Libraries/LibWeb/HTML/FormControlInfrastructure.cpp index 6d4374e25e..0e18b228ab 100644 --- a/Userland/Libraries/LibWeb/HTML/FormControlInfrastructure.cpp +++ b/Userland/Libraries/LibWeb/HTML/FormControlInfrastructure.cpp @@ -125,8 +125,8 @@ WebIDL::ExceptionOr>> construct_entry_list(J value = "on"_string; // 2. Create an entry with name and value, and append it to entry list. - auto checkbox_or_radio_element_name = TRY_OR_THROW_OOM(vm, String::from_byte_string(checkbox_or_radio_element->name())); - entry_list.append(XHR::FormDataEntry { .name = move(checkbox_or_radio_element_name), .value = move(value) }); + auto checkbox_or_radio_element_name = checkbox_or_radio_element->name(); + entry_list.append(XHR::FormDataEntry { .name = checkbox_or_radio_element_name->to_string(), .value = move(value) }); } // 8. Otherwise, if the field element is an input element whose type attribute is in the File Upload state, then: else if (auto* file_element = dynamic_cast(control.ptr()); file_element && file_element->type_state() == HTMLInputElement::TypeAttributeState::FileUpload) { diff --git a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp index ef0d1a5147..25763fe1eb 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp @@ -965,9 +965,9 @@ static bool is_in_same_radio_button_group(HTML::HTMLInputElement const& a, HTML: && a.form() == b.form() // - They both have a name attribute, their name attributes are not empty, and the // value of a's name attribute equals the value of b's name attribute. - && a.has_attribute(HTML::AttributeNames::name) - && b.has_attribute(HTML::AttributeNames::name) - && non_empty_equals(a.name(), b.name())); + && a.name().has_value() + && b.name().has_value() + && non_empty_equals(a.name().value(), b.name().value())); } // https://html.spec.whatwg.org/multipage/input.html#radio-button-state-(type=radio) @@ -979,8 +979,7 @@ void HTMLInputElement::set_checked_within_group() set_checked(true, ChangeSource::User); // No point iterating the tree if we have an empty name. - auto name = this->name(); - if (name.is_empty()) + if (!name().has_value() || name()->is_empty()) return; document().for_each_in_inclusive_subtree_of_type([&](auto& element) { @@ -1010,8 +1009,6 @@ void HTMLInputElement::legacy_pre_activation_behavior() // has its checkedness set to true, if any, and then set this element's // checkedness to true. if (type_state() == TypeAttributeState::RadioButton) { - ByteString name = this->name(); - document().for_each_in_inclusive_subtree_of_type([&](auto& element) { if (element.checked() && is_in_same_radio_button_group(*this, element)) { m_legacy_pre_activation_behavior_checked_element_in_group = &element; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h index 4eb95e6bde..b9d184b325 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h @@ -65,7 +65,6 @@ public: WebIDL::ExceptionOr set_type(String const&); ByteString default_value() const { return deprecated_attribute(HTML::AttributeNames::value); } - ByteString name() const { return deprecated_attribute(HTML::AttributeNames::name); } virtual String value() const override; WebIDL::ExceptionOr set_value(String const&);