diff options
author | Ms2ger <ms2ger@gmail.com> | 2014-06-08 14:53:48 +0200 |
---|---|---|
committer | Ms2ger <ms2ger@gmail.com> | 2014-06-13 14:07:49 +0200 |
commit | 0803e5d0aca8f803dcd88831cb7fd0f56021ebc9 (patch) | |
tree | 5baabf0b9d0addfd8567a8899e2db270b63c1ae5 /src/components/script/dom/virtualmethods.rs | |
parent | 37e9458514b8592c455cd42a3f4151012dde4f13 (diff) | |
download | servo-0803e5d0aca8f803dcd88831cb7fd0f56021ebc9.tar.gz servo-0803e5d0aca8f803dcd88831cb7fd0f56021ebc9.zip |
Implement support for parsed attributes.
This commit is heavily based on earlier work by Bruno Abinader in #2073.
Diffstat (limited to 'src/components/script/dom/virtualmethods.rs')
-rw-r--r-- | src/components/script/dom/virtualmethods.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/components/script/dom/virtualmethods.rs b/src/components/script/dom/virtualmethods.rs index aafe3efe4f4..b32af5139da 100644 --- a/src/components/script/dom/virtualmethods.rs +++ b/src/components/script/dom/virtualmethods.rs @@ -2,6 +2,7 @@ * 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::{AttrValue, StringAttrValue}; use dom::bindings::codegen::InheritTypes::ElementCast; use dom::bindings::codegen::InheritTypes::HTMLAnchorElementCast; use dom::bindings::codegen::InheritTypes::HTMLBodyElementCast; @@ -50,6 +51,15 @@ pub trait VirtualMethods { } } + /// Returns the right AttrValue variant for the attribute with name `name` + /// on this element. + fn parse_plain_attribute(&self, name: &str, value: DOMString) -> AttrValue { + match self.super_type() { + Some(ref s) => s.parse_plain_attribute(name, value), + _ => StringAttrValue(value), + } + } + /// Called when a Node is appended to a tree that is part of a Document. fn bind_to_tree(&self) { match self.super_type() { |