mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Use fn in_same_group where appropriate
This commit is contained in:
parent
0541a01924
commit
f54a8fc845
1 changed files with 2 additions and 6 deletions
|
@ -994,16 +994,12 @@ impl Activatable for HTMLInputElement {
|
||||||
InputType::InputRadio => {
|
InputType::InputRadio => {
|
||||||
// We want to restore state only if the element had been changed in the first place
|
// We want to restore state only if the element had been changed in the first place
|
||||||
if cache.was_mutable {
|
if cache.was_mutable {
|
||||||
let name = self.radio_group_name();
|
|
||||||
match cache.checked_radio.r() {
|
match cache.checked_radio.r() {
|
||||||
Some(o) => {
|
Some(o) => {
|
||||||
// Avoiding iterating through the whole tree here, instead
|
// Avoiding iterating through the whole tree here, instead
|
||||||
// we can check if the conditions for radio group siblings apply
|
// we can check if the conditions for radio group siblings apply
|
||||||
if name == o.radio_group_name() && // TODO should be compatibility caseless
|
if in_same_group(&o, self.form_owner().r(), self.radio_group_name().as_ref()) {
|
||||||
self.form_owner() == o.form_owner() &&
|
o.SetChecked(true);
|
||||||
// TODO Both a and b are in the same home subtree
|
|
||||||
o.input_type.get() == InputType::InputRadio {
|
|
||||||
o.SetChecked(true);
|
|
||||||
} else {
|
} else {
|
||||||
self.SetChecked(false);
|
self.SetChecked(false);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue