Restrict output of getElementsByName to HTML elements

https://html.spec.whatwg.org/#dom-document-getelementsbyname
This commit is contained in:
Philipp Hartwig 2015-05-31 20:26:47 +02:00
parent c63fc4dc13
commit 2779e0a7ed

View file

@ -1540,6 +1540,9 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
Some(element) => element,
None => return false,
};
if element.namespace() != &ns!(HTML) {
return false;
}
element.get_attribute(&ns!(""), &atom!("name")).root().map_or(false, |attr| {
// FIXME(https://github.com/rust-lang/rust/issues/23338)
let attr = attr.r();