Don't include the root element when calling Element#getElementsByTagName

Fixes #4249
This commit is contained in:
Emanuel Rylke 2014-12-09 13:37:12 +01:00
parent 02955d39cc
commit 8ed6ace682
2 changed files with 4 additions and 5 deletions

View file

@ -85,7 +85,10 @@ impl HTMLCollection {
ascii_lower_tag: Atom,
}
impl CollectionFilter for TagNameFilter {
fn filter(&self, elem: JSRef<Element>, _root: JSRef<Node>) -> bool {
fn filter(&self, elem: JSRef<Element>, root: JSRef<Node>) -> bool {
if NodeCast::from_ref(elem) == root {
return false
}
if elem.html_element_in_html_document() {
*elem.local_name() == self.ascii_lower_tag
} else {