Implement Element.className

This commit is contained in:
Bruno de Oliveira Abinader 2014-03-13 13:48:24 -04:00
parent 3933d17262
commit 6274ecba07
6 changed files with 50 additions and 14 deletions

View file

@ -52,6 +52,7 @@ DOMInterfaces = {
'Element': {
'needsAbstract': [
'attributes',
'className',
'getBoundingClientRect',
'getClientRects',
'getElementsByClassName',

View file

@ -430,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 {

View file

@ -140,13 +140,6 @@ impl HTMLElement {
Ok(())
}
pub fn ClassName(&self) -> DOMString {
~""
}
pub fn SetClassName(&self, _class: DOMString) {
}
pub fn GetOffsetParent(&self) -> Option<JS<Element>> {
None
}

View file

@ -28,10 +28,8 @@ interface Element : Node {
[Pure]
attribute DOMString id;
/*
FIXME Bug 810677 Move className from HTMLElement to Element
[Pure]
attribute DOMString className;
*/
/*[Constant]
readonly attribute DOMTokenList? classList;*/

View file

@ -43,10 +43,6 @@ interface HTMLElement : Element {
readonly attribute boolean isContentEditable;
[SetterThrows, Pure]
attribute boolean spellcheck;
// Mozilla specific stuff
// FIXME Bug 810677 Move className from HTMLElement to Element
attribute DOMString className;
};
// http://dev.w3.org/csswg/cssom-view/#extensions-to-the-htmlelement-interface