1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 15:48:12 +00:00

LibWeb: Ensure that radio group is updated when radio is checked from JS

Fixes test 56 in Acid3.

Farewell, radio eyes, you will be missed. :^(
This commit is contained in:
sin-ack 2022-03-15 01:13:05 +00:00 committed by Andreas Kling
parent 436262ea3a
commit 57a85b1017
3 changed files with 16 additions and 1 deletions

View file

@ -70,6 +70,18 @@ void HTMLInputElement::set_checked(bool checked, ChangeSource change_source)
set_needs_style_update(true);
}
void HTMLInputElement::set_checked_binding(bool checked)
{
if (type() == "radio") {
if (checked)
set_checked_within_group();
else
set_checked(false, ChangeSource::Programmatic);
} else {
set_checked(checked, ChangeSource::Programmatic);
}
}
// https://html.spec.whatwg.org/multipage/input.html#input-activation-behavior
void HTMLInputElement::run_input_activation_behavior()
{

View file

@ -69,6 +69,9 @@ public:
};
void set_checked(bool, ChangeSource = ChangeSource::Programmatic);
bool checked_binding() const { return checked(); }
void set_checked_binding(bool);
void did_edit_text_node(Badge<BrowsingContext>);
virtual bool is_focusable() const override;

View file

@ -21,7 +21,7 @@ interface HTMLInputElement : HTMLElement {
[LegacyNullToEmptyString] attribute DOMString value;
attribute boolean checked;
[ImplementedAs=checked_binding] attribute boolean checked;
[Reflect] attribute boolean disabled;
[Reflect=checked] attribute boolean defaultChecked;