Implemented {Document,Element}.getElementsByTagNameNS

This commit is contained in:
Bruno de Oliveira Abinader 2014-02-27 13:18:03 -04:00
parent d22dbb53ca
commit e1499b610e
6 changed files with 26 additions and 6 deletions

View file

@ -35,7 +35,7 @@ use dom::window::Window;
use html::hubbub_html_parser::build_element_from_tag;
use hubbub::hubbub::{QuirksMode, NoQuirks, LimitedQuirks, FullQuirks};
use layout_interface::{DocumentDamageLevel, ContentChangedDocumentDamage};
use servo_util::namespace::Null;
use servo_util::namespace::{Namespace, Null};
use servo_util::str::DOMString;
use extra::url::{Url, from_str};
@ -216,6 +216,15 @@ impl Document {
HTMLCollection::by_tag_name(&self.window, &NodeCast::from(abstract_self), tag_name)
}
// http://dom.spec.whatwg.org/#dom-document-getelementsbytagnamens
pub fn GetElementsByTagNameNS(&self, abstract_self: &JS<Document>, maybe_ns: Option<DOMString>, tag_name: DOMString) -> JS<HTMLCollection> {
let namespace = match maybe_ns {
Some(namespace) => Namespace::from_str(namespace),
None => Null
};
HTMLCollection::by_tag_name_ns(&self.window, &NodeCast::from(abstract_self), tag_name, namespace)
}
// 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"