1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:37:35 +00:00

LibWeb: Make <input type=checkbox> honor the "checked" attribute

Implemented according to spec, although it's very possible that I missed
one or two details. :^)
This commit is contained in:
Andreas Kling 2022-02-15 19:16:57 +01:00
parent 05c9fd962d
commit 8a89a7bd95
4 changed files with 70 additions and 8 deletions

View file

@ -114,12 +114,12 @@ void RadioButton::set_checked_within_group()
if (dom_node().checked())
return;
dom_node().set_checked(true);
dom_node().set_checked(true, HTML::HTMLInputElement::ChangeSource::User);
String name = dom_node().name();
document().for_each_in_inclusive_subtree_of_type<HTML::HTMLInputElement>([&](auto& element) {
if (element.checked() && (element.layout_node() != this) && (element.name() == name))
element.set_checked(false);
element.set_checked(false, HTML::HTMLInputElement::ChangeSource::User);
return IterationDecision::Continue;
});
}