From 8ed6ace682dff1fe866b411553de0b5494094d57 Mon Sep 17 00:00:00 2001 From: Emanuel Rylke Date: Tue, 9 Dec 2014 13:37:12 +0100 Subject: Don't include the root element when calling Element#getElementsByTagName Fixes #4249 --- components/script/dom/htmlcollection.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'components/script/dom/htmlcollection.rs') diff --git a/components/script/dom/htmlcollection.rs b/components/script/dom/htmlcollection.rs index c07af986135..3ac4d491513 100644 --- a/components/script/dom/htmlcollection.rs +++ b/components/script/dom/htmlcollection.rs @@ -85,7 +85,10 @@ impl HTMLCollection { ascii_lower_tag: Atom, } impl CollectionFilter for TagNameFilter { - fn filter(&self, elem: JSRef, _root: JSRef) -> bool { + fn filter(&self, elem: JSRef, root: JSRef) -> bool { + if NodeCast::from_ref(elem) == root { + return false + } if elem.html_element_in_html_document() { *elem.local_name() == self.ascii_lower_tag } else { -- cgit v1.2.3