summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp
diff options
context:
space:
mode:
authorMacDue <macdue@dueutil.tech>2023-03-26 18:53:55 +0100
committerLinus Groh <mail@linusgroh.de>2023-03-26 21:55:21 +0100
commit17d23590bf4df007c7ca8250e761bf73bc1bdacf (patch)
tree006ca0e1ee70ff365680b33fc3d4e800a319ff85 /Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp
parent32653f34f94779893837cbfed01ab2dba562cf3e (diff)
downloadserenity-17d23590bf4df007c7ca8250e761bf73bc1bdacf.zip
LibWeb: Check for empty name in is_in_same_radio_button_group()
I missed this check in #18046 (though it was covered in one case by an optimization).
Diffstat (limited to 'Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp')
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp
index e88f92b470..00ff9cb2bb 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp
@@ -794,6 +794,9 @@ void HTMLInputElement::form_associated_element_was_inserted()
// https://html.spec.whatwg.org/multipage/input.html#radio-button-group
static bool is_in_same_radio_button_group(HTML::HTMLInputElement const& a, HTML::HTMLInputElement const& b)
{
+ auto non_empty_equals = [](auto const& value_a, auto const& value_b) {
+ return !value_a.is_empty() && value_a == value_b;
+ };
// The radio button group that contains an input element a also contains all the
// other input elements b that fulfill all of the following conditions:
return (
@@ -807,7 +810,7 @@ static bool is_in_same_radio_button_group(HTML::HTMLInputElement const& a, HTML:
// 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)
- && a.name() == b.name());
+ && non_empty_equals(a.name(), b.name()));
}
// https://html.spec.whatwg.org/multipage/input.html#radio-button-state-(type=radio)