diff options
Diffstat (limited to 'src/components/script/dom/element.rs')
-rw-r--r-- | src/components/script/dom/element.rs | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/src/components/script/dom/element.rs b/src/components/script/dom/element.rs index 95e4e7f9af9..55cec200304 100644 --- a/src/components/script/dom/element.rs +++ b/src/components/script/dom/element.rs @@ -156,6 +156,17 @@ impl Element { self.node.owner_doc().get().is_html_document } + pub unsafe fn html_element_in_html_document_for_layout(&self) -> bool { + if self.namespace != namespace::HTML { + return false + } + let owner_doc: *JS<Document> = self.node.owner_doc(); + let owner_doc: **Document = cast::transmute::<*JS<Document>, + **Document>( + owner_doc); + (**owner_doc).is_html_document + } + pub fn get_attribute(&self, namespace: Namespace, name: &str) -> Option<JS<Attr>> { @@ -241,7 +252,7 @@ impl Element { match local_name.as_slice() { "style" => { let doc = self.node.owner_doc(); - let base_url = doc.get().extra.url.clone(); + let base_url = doc.get().url().clone(); self.style_attribute = Some(style::parse_style_attribute(value, &base_url)) } "id" => { @@ -249,7 +260,7 @@ impl Element { if self_node.is_in_doc() { // XXX: this dual declaration are workaround to avoid the compile error: // "borrowed value does not live long enough" - let mut doc = self.node.owner_doc(); + let mut doc = self.node.owner_doc().clone(); let doc = doc.get_mut(); doc.register_named_element(abstract_self, value.clone()); } @@ -318,7 +329,7 @@ impl Element { if self_node.is_in_doc() { // XXX: this dual declaration are workaround to avoid the compile error: // "borrowed value does not live long enough" - let mut doc = self.node.owner_doc(); + let mut doc = self.node.owner_doc().clone(); let doc = doc.get_mut(); doc.unregister_named_element(old_value); } @@ -419,6 +430,16 @@ impl Element { self.set_string_attribute(abstract_self, "id", id); } + // http://dom.spec.whatwg.org/#dom-element-classname + pub fn ClassName(&self, _abstract_self: &JS<Element>) -> DOMString { + self.get_string_attribute("class") + } + + // http://dom.spec.whatwg.org/#dom-element-classname + pub fn SetClassName(&mut self, abstract_self: &JS<Element>, class: DOMString) { + self.set_string_attribute(abstract_self, "class", class); + } + // http://dom.spec.whatwg.org/#dom-element-attributes pub fn Attributes(&mut self, abstract_self: &JS<Element>) -> JS<AttrList> { match self.attr_list { |