aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/htmloptgroupelement.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom/htmloptgroupelement.rs')
-rw-r--r--components/script/dom/htmloptgroupelement.rs24
1 files changed, 14 insertions, 10 deletions
diff --git a/components/script/dom/htmloptgroupelement.rs b/components/script/dom/htmloptgroupelement.rs
index b90eacff87f..cabb19936ab 100644
--- a/components/script/dom/htmloptgroupelement.rs
+++ b/components/script/dom/htmloptgroupelement.rs
@@ -5,12 +5,13 @@
use dom::attr::Attr;
use dom::bindings::codegen::Bindings::HTMLOptGroupElementBinding;
use dom::bindings::codegen::Bindings::HTMLOptGroupElementBinding::HTMLOptGroupElementMethods;
-use dom::bindings::codegen::InheritTypes::{HTMLElementCast, HTMLOptionElementDerived, NodeCast};
+use dom::bindings::codegen::InheritTypes::{ElementCast, HTMLElementCast, HTMLOptionElementCast};
+use dom::bindings::codegen::InheritTypes::{HTMLOptionElementDerived, NodeCast};
use dom::bindings::js::Root;
use dom::document::Document;
-use dom::element::AttributeMutation;
+use dom::element::{AttributeMutation, IN_ENABLED_STATE};
use dom::htmlelement::HTMLElement;
-use dom::node::{IN_ENABLED_STATE, Node, NodeFlags};
+use dom::node::{Node};
use dom::virtualmethods::VirtualMethods;
use util::str::DOMString;
@@ -25,7 +26,7 @@ impl HTMLOptGroupElement {
document: &Document) -> HTMLOptGroupElement {
HTMLOptGroupElement {
htmlelement:
- HTMLElement::new_inherited_with_flags(NodeFlags::new() | IN_ENABLED_STATE,
+ HTMLElement::new_inherited_with_state(IN_ENABLED_STATE,
localName, prefix, document)
}
}
@@ -66,19 +67,22 @@ impl VirtualMethods for HTMLOptGroupElement {
AttributeMutation::Removed => false,
};
let node = NodeCast::from_ref(self);
- node.set_disabled_state(disabled_state);
- node.set_enabled_state(!disabled_state);
+ let el = ElementCast::from_ref(self);
+ el.set_disabled_state(disabled_state);
+ el.set_enabled_state(!disabled_state);
let options = node.children().filter(|child| {
child.is_htmloptionelement()
- });
+ }).map(|child| Root::from_ref(HTMLOptionElementCast::to_ref(child.r()).unwrap()));
if disabled_state {
for option in options {
- option.set_disabled_state(true);
- option.set_enabled_state(false);
+ let el = ElementCast::from_ref(option.r());
+ el.set_disabled_state(true);
+ el.set_enabled_state(false);
}
} else {
for option in options {
- option.check_disabled_attribute();
+ let el = ElementCast::from_ref(option.r());
+ el.check_disabled_attribute();
}
}
},