diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index d5181e221fb..f01c51513ec 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -2663,15 +2663,11 @@ impl Element { self.set_enabled_state(false); return; } - match ancestor.children() - .find(|child| child.is::()) { - Some(ref legend) => { - // XXXabinader: should we save previous ancestor to avoid this iteration? - if node.ancestors().any(|ancestor| ancestor == *legend) { - continue; - } - }, - None => (), + if let Some(ref legend) = ancestor.children().find(|n| n.is::()) { + // XXXabinader: should we save previous ancestor to avoid this iteration? + if node.ancestors().any(|ancestor| ancestor == *legend) { + continue; + } } self.set_disabled_state(true); self.set_enabled_state(false);