Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(271)

Unified Diff: Source/core/dom/ElementTraversal.h

Issue 229213002: Make HTMLCollection / NodeList backward traversal consistent with forward one (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/dom/ElementTraversal.h
diff --git a/Source/core/dom/ElementTraversal.h b/Source/core/dom/ElementTraversal.h
index e6d7e924ed65168990537f355f2588727990de9f..e8241820b5e4abd39d4ff5530eba1fc289616f5b 100644
--- a/Source/core/dom/ElementTraversal.h
+++ b/Source/core/dom/ElementTraversal.h
@@ -119,7 +119,10 @@ template <>
template <class NodeType>
inline Element* Traversal<Element>::lastWithinTemplate(NodeType& current)
{
- return lastChildTemplate(current);
+ Node* node = NodeTraversal::lastWithin(current);
Inactive 2014/04/09 23:19:07 Also see that WebKit is doing the same thing that
+ while (node && !node->isElementNode())
+ node = NodeTraversal::previous(*node, &current);
+ return toElement(node);
}
template <>

Powered by Google App Engine
This is Rietveld 408576698