| Index: third_party/WebKit/Source/core/dom/SelectorQuery.cpp
|
| diff --git a/third_party/WebKit/Source/core/dom/SelectorQuery.cpp b/third_party/WebKit/Source/core/dom/SelectorQuery.cpp
|
| index facc59beef3a63cb3c3f468998d53c18b46c81bd..9fc5886c2acef31281dde655c4feeca57445cec5 100644
|
| --- a/third_party/WebKit/Source/core/dom/SelectorQuery.cpp
|
| +++ b/third_party/WebKit/Source/core/dom/SelectorQuery.cpp
|
| @@ -259,8 +259,8 @@ void SelectorDataList::findTraverseRootsAndExecute(ContainerNode& rootNode, type
|
| bool startFromParent = false;
|
|
|
| for (const CSSSelector* selector = m_selectors[0]; selector; selector = selector->tagHistory()) {
|
| - if (selector->match() == CSSSelector::Id && !rootNode.treeScope().containsMultipleElementsWithId(selector->value())) {
|
| - Element* element = rootNode.treeScope().getElementById(selector->value());
|
| + if (selector->match() == CSSSelector::Id && rootNode.isInTreeScope() && !rootNode.containingTreeScope().containsMultipleElementsWithId(selector->value())) {
|
| + Element* element = rootNode.containingTreeScope().getElementById(selector->value());
|
| ContainerNode* adjustedNode = &rootNode;
|
| if (element && (isTreeScopeRoot(rootNode) || element->isDescendantOf(&rootNode)))
|
| adjustedNode = element;
|
|
|