Implement support for parsed attributes.

This commit is heavily based on earlier work by Bruno Abinader in #2073.
This commit is contained in:
Ms2ger 2014-06-08 14:53:48 +02:00
parent 37e9458514
commit 0803e5d0ac
4 changed files with 90 additions and 17 deletions

View file

@ -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() {