script: Simplify propagation of disabled state for form controls.

That's a silly exponential algorithm btw.
This commit is contained in:
Emilio Cobos Álvarez 2016-12-25 17:29:02 +01:00
parent d1b175d145
commit 157ce33105
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C

View file

@ -2663,15 +2663,11 @@ impl Element {
self.set_enabled_state(false); self.set_enabled_state(false);
return; return;
} }
match ancestor.children() if let Some(ref legend) = ancestor.children().find(|n| n.is::<HTMLLegendElement>()) {
.find(|child| child.is::<HTMLLegendElement>()) { // XXXabinader: should we save previous ancestor to avoid this iteration?
Some(ref legend) => { if node.ancestors().any(|ancestor| ancestor == *legend) {
// XXXabinader: should we save previous ancestor to avoid this iteration? continue;
if node.ancestors().any(|ancestor| ancestor == *legend) { }
continue;
}
},
None => (),
} }
self.set_disabled_state(true); self.set_disabled_state(true);
self.set_enabled_state(false); self.set_enabled_state(false);