From f54a8fc8456afe8a8d8c2edc0890694506e175f3 Mon Sep 17 00:00:00 2001 From: Keith Yeung Date: Mon, 11 Apr 2016 08:41:46 -0400 Subject: [PATCH] Use fn in_same_group where appropriate --- components/script/dom/htmlinputelement.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs index e703e38f16b..845010ce627 100644 --- a/components/script/dom/htmlinputelement.rs +++ b/components/script/dom/htmlinputelement.rs @@ -994,16 +994,12 @@ impl Activatable for HTMLInputElement { InputType::InputRadio => { // We want to restore state only if the element had been changed in the first place if cache.was_mutable { - let name = self.radio_group_name(); match cache.checked_radio.r() { Some(o) => { // Avoiding iterating through the whole tree here, instead // we can check if the conditions for radio group siblings apply - if name == o.radio_group_name() && // TODO should be compatibility caseless - self.form_owner() == o.form_owner() && - // TODO Both a and b are in the same home subtree - o.input_type.get() == InputType::InputRadio { - o.SetChecked(true); + if in_same_group(&o, self.form_owner().r(), self.radio_group_name().as_ref()) { + o.SetChecked(true); } else { self.SetChecked(false); }