Implemented {Document,Element}.getElementsByClassName

This commit is contained in:
Bruno de Oliveira Abinader 2014-02-27 13:18:29 -04:00
parent e1499b610e
commit d010861b75
5 changed files with 24 additions and 4 deletions

View file

@ -225,6 +225,11 @@ impl Document {
HTMLCollection::by_tag_name_ns(&self.window, &NodeCast::from(abstract_self), tag_name, namespace)
}
// http://dom.spec.whatwg.org/#dom-document-getelementsbyclassname
pub fn GetElementsByClassName(&self, abstract_self: &JS<Document>, classes: DOMString) -> JS<HTMLCollection> {
HTMLCollection::by_class_name(&self.window, &NodeCast::from(abstract_self), classes)
}
// http://dom.spec.whatwg.org/#dom-nonelementparentnode-getelementbyid
pub fn GetElementById(&self, id: DOMString) -> Option<JS<Element>> {
// TODO: "in tree order, within the context object's tree"