diff options
author | bors-servo <metajack+bors@gmail.com> | 2014-10-22 09:33:37 -0600 |
---|---|---|
committer | bors-servo <metajack+bors@gmail.com> | 2014-10-22 09:33:37 -0600 |
commit | 590a93120a26ab6ea787831d7ba08c47423148bc (patch) | |
tree | 4badb6e43662adf383b42b7c5c95a462737905fb /components/script/dom/htmloptgroupelement.rs | |
parent | 22d6aaf36980cdcb0202acc2576dfe742aafe885 (diff) | |
parent | bbab8831e0286be7ebf0c2dc964d6a6b6c30d65f (diff) | |
download | servo-590a93120a26ab6ea787831d7ba08c47423148bc.tar.gz servo-590a93120a26ab6ea787831d7ba08c47423148bc.zip |
auto merge of #3757 : brunoabinader/servo/content_changed, r=jdm
```JSRef<Attr>``` does not require allocating a ```DOMString``` for value, which are unused in most cases. It also provides more access to ```Attr``` data.
Diffstat (limited to 'components/script/dom/htmloptgroupelement.rs')
-rw-r--r-- | components/script/dom/htmloptgroupelement.rs | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/components/script/dom/htmloptgroupelement.rs b/components/script/dom/htmloptgroupelement.rs index fac03df2f77..e464fccfaf6 100644 --- a/components/script/dom/htmloptgroupelement.rs +++ b/components/script/dom/htmloptgroupelement.rs @@ -2,6 +2,8 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +use dom::attr::Attr; +use dom::attr::AttrHelpers; use dom::bindings::codegen::Bindings::HTMLOptGroupElementBinding; use dom::bindings::codegen::Bindings::HTMLOptGroupElementBinding::HTMLOptGroupElementMethods; use dom::bindings::codegen::InheritTypes::{HTMLElementCast, NodeCast}; @@ -57,15 +59,15 @@ impl<'a> VirtualMethods for JSRef<'a, HTMLOptGroupElement> { Some(htmlelement as &VirtualMethods) } - fn after_set_attr(&self, name: &Atom, value: DOMString) { + fn after_set_attr(&self, attr: JSRef<Attr>) { match self.super_type() { - Some(ref s) => s.after_set_attr(name, value.clone()), - _ => (), + Some(ref s) => s.after_set_attr(attr), + _ => () } - let node: JSRef<Node> = NodeCast::from_ref(*self); - match name.as_slice() { - "disabled" => { + match attr.local_name() { + &atom!("disabled") => { + let node: JSRef<Node> = NodeCast::from_ref(*self); node.set_disabled_state(true); node.set_enabled_state(false); for child in node.children().filter(|child| child.is_htmloptionelement()) { @@ -77,15 +79,15 @@ impl<'a> VirtualMethods for JSRef<'a, HTMLOptGroupElement> { } } - fn before_remove_attr(&self, name: &Atom, value: DOMString) { + fn before_remove_attr(&self, attr: JSRef<Attr>) { match self.super_type() { - Some(ref s) => s.before_remove_attr(name, value), - _ => (), + Some(ref s) => s.before_remove_attr(attr), + _ => () } - let node: JSRef<Node> = NodeCast::from_ref(*self); - match name.as_slice() { - "disabled" => { + match attr.local_name() { + &atom!("disabled") => { + let node: JSRef<Node> = NodeCast::from_ref(*self); node.set_disabled_state(false); node.set_enabled_state(true); for child in node.children().filter(|child| child.is_htmloptionelement()) { |