mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-28 15:28:55 +00:00
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).
This commit is contained in:
parent
32653f34f9
commit
17d23590bf
Notes:
sideshowbarker
2024-07-17 05:21:12 +09:00
Author: https://github.com/MacDue
Commit: 17d23590bf
Pull-request: https://github.com/SerenityOS/serenity/pull/18054
Reviewed-by: https://github.com/awesomekling
Reviewed-by: https://github.com/linusg
1 changed files with 4 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue