Skip to content

Commit

Permalink
servo: Merge #4354 - Don't include the root element when calling Elem…
Browse files Browse the repository at this point in the history
…ent#getElementsByTagNameNS (from neojski:getElementsByTagNameNS-filter-root); r=Ms2ger

This fixes #4349.

Source-Repo: https://github.com/servo/servo
Source-Revision: 9e83f096a5b61beb7a26c222b1f6d7780b1335b0
  • Loading branch information
neojski committed Dec 12, 2014
1 parent e289ac1 commit db5adf6
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions servo/components/script/dom/htmlcollection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ impl HTMLCollection {
namespace_filter: Option<Namespace>
}
impl CollectionFilter for AllElementFilter {
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
}
match self.namespace_filter {
None => true,
Some(ref namespace) => *elem.namespace() == *namespace
Expand Down Expand Up @@ -119,7 +122,10 @@ impl HTMLCollection {
namespace_filter: Option<Namespace>
}
impl CollectionFilter for TagNameNSFilter {
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
}
let ns_match = match self.namespace_filter {
Some(ref namespace) => {
*elem.namespace() == *namespace
Expand Down

0 comments on commit db5adf6

Please sign in to comment.