aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/script/dom/element.rs
diff options
context:
space:
mode:
authorDaniel Glazman <daniel@glazman.org>2013-12-09 15:01:47 +0100
committerDaniel Glazman <daniel@glazman.org>2013-12-09 15:55:51 +0100
commit28575c20bfc0cf8040333428451fdecd32a4bca5 (patch)
treea87225bccc7759a6168d7a15f27d8c8ba169a692 /src/components/script/dom/element.rs
parent76e3b34c758fc732414ae2e3008f4c57b7b94c90 (diff)
downloadservo-28575c20bfc0cf8040333428451fdecd32a4bca5.tar.gz
servo-28575c20bfc0cf8040333428451fdecd32a4bca5.zip
add namespaces to elements
Diffstat (limited to 'src/components/script/dom/element.rs')
-rw-r--r--src/components/script/dom/element.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/components/script/dom/element.rs b/src/components/script/dom/element.rs
index 955c52a8845..82cd7207f8e 100644
--- a/src/components/script/dom/element.rs
+++ b/src/components/script/dom/element.rs
@@ -30,6 +30,7 @@ use std::ascii::StrAsciiExt;
pub struct Element {
node: Node<ScriptView>,
tag_name: ~str, // TODO: This should be an atom, not a ~str.
+ namespace: Namespace,
attrs: HashMap<~str, ~[@mut Attr]>,
attrs_insert_order: ~[(~str, Namespace)], // store an order of attributes.
style_attribute: Option<style::PropertyDeclarationBlock>,
@@ -128,6 +129,10 @@ impl ElementLike for Element {
self.tag_name.as_slice()
}
+ fn get_namespace<'a>(&'a self) -> ~str {
+ self.namespace.to_str().unwrap_or(~"")
+ }
+
fn get_attr(&self, name: &str) -> Option<~str> {
self.get_attribute(None, name).map(|attr| attr.value.clone())
}
@@ -146,10 +151,11 @@ impl ElementLike for Element {
}
impl<'self> Element {
- pub fn new(type_id: ElementTypeId, tag_name: ~str, document: AbstractDocument) -> Element {
+ pub fn new(type_id: ElementTypeId, tag_name: ~str, namespace: Namespace, document: AbstractDocument) -> Element {
Element {
node: Node::new(ElementNodeTypeId(type_id), document),
tag_name: tag_name,
+ namespace: namespace,
attrs: HashMap::new(),
attrs_insert_order: ~[],
attr_list: None,