Index: Source/core/dom/TreeScope.cpp |
diff --git a/Source/core/dom/TreeScope.cpp b/Source/core/dom/TreeScope.cpp |
index deab41141b9feda7538f2647e8e6ccb68087532e..b2c6acb9fe994f1df982faf858f2fd9a6dca1c13 100644 |
--- a/Source/core/dom/TreeScope.cpp |
+++ b/Source/core/dom/TreeScope.cpp |
@@ -524,10 +524,10 @@ Element* TreeScope::getElementByAccessKey(const String& key) const |
return 0; |
Element* result = 0; |
Node& root = rootNode(); |
- for (Element* element = ElementTraversal::firstWithin(root); element; element = ElementTraversal::next(*element, &root)) { |
- if (equalIgnoringCase(element->fastGetAttribute(accesskeyAttr), key)) |
- result = element; |
- for (ShadowRoot* shadowRoot = element->youngestShadowRoot(); shadowRoot; shadowRoot = shadowRoot->olderShadowRoot()) { |
+ for (Element& element : ElementTraversal::descendantsOf(root)) { |
+ if (equalIgnoringCase(element.fastGetAttribute(accesskeyAttr), key)) |
+ result = &element; |
+ for (ShadowRoot* shadowRoot = element.youngestShadowRoot(); shadowRoot; shadowRoot = shadowRoot->olderShadowRoot()) { |
if (Element* shadowResult = shadowRoot->getElementByAccessKey(key)) |
result = shadowResult; |
} |