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);
return;
}
match ancestor.children()
.find(|child| child.is::<HTMLLegendElement>()) {
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::<HTMLLegendElement>()) {
// 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);