Index: Source/core/dom/SelectorQuery.cpp |
diff --git a/Source/core/dom/SelectorQuery.cpp b/Source/core/dom/SelectorQuery.cpp |
index bfaa3715f43f280e24deba2e43f464b699e7dfdb..8f9f4a4e6d79c1b5d2b9188a81afc4b595d38392 100644 |
--- a/Source/core/dom/SelectorQuery.cpp |
+++ b/Source/core/dom/SelectorQuery.cpp |
@@ -337,6 +337,8 @@ void SelectorDataList::executeQueryAll(Node& rootNode, Vector<RefPtr<Node> >& ma |
for (size_t i = 0; i < count; ++i) { |
Element* element = elements[i]; |
ASSERT(element); |
+ if (!(isTreeScopeRoot(rootNode) || element->isDescendantOf(&rootNode))) |
+ continue; |
if (selectorMatches(selector, *element, rootNode)) |
matchedElements.append(element); |
} |
@@ -463,6 +465,8 @@ Element* SelectorDataList::executeQueryFirst(Node& rootNode) const |
for (size_t i = 0; i < count; ++i) { |
Element* element = elements[i]; |
ASSERT(element); |
+ if (!(isTreeScopeRoot(rootNode) || element->isDescendantOf(&rootNode))) |
Inactive
2014/01/05 20:46:33
FYI, I am planning on working on getting rid of th
|
+ continue; |
if (selectorMatches(selector, *element, rootNode)) |
return element; |
} |