Index: Source/core/html/HTMLAllCollection.cpp |
diff --git a/Source/core/html/HTMLAllCollection.cpp b/Source/core/html/HTMLAllCollection.cpp |
index f9bbdf6e70d7640777da35c71d5a23b07f4f1fd6..e3bba65f05aac24ede580eb6a925af7e79eaf52b 100644 |
--- a/Source/core/html/HTMLAllCollection.cpp |
+++ b/Source/core/html/HTMLAllCollection.cpp |
@@ -50,15 +50,16 @@ Element* HTMLAllCollection::namedItemWithIndex(const AtomicString& name, unsigne |
{ |
updateIdNameCache(); |
- if (Vector<Element*>* cache = idCache(name)) { |
- if (index < cache->size()) |
- return cache->at(index); |
- index -= cache->size(); |
+ const NamedItemCache& cache = namedItemCache(); |
+ if (Vector<Element*>* elements = cache.getElementsById(name)) { |
+ if (index < elements->size()) |
+ return elements->at(index); |
+ index -= elements->size(); |
} |
- if (Vector<Element*>* cache = nameCache(name)) { |
- if (index < cache->size()) |
- return cache->at(index); |
+ if (Vector<Element*>* elements = cache.getElementsByName(name)) { |
+ if (index < elements->size()) |
+ return elements->at(index); |
} |
return 0; |