Index: Source/core/html/HTMLCollection.h |
diff --git a/Source/core/html/HTMLCollection.h b/Source/core/html/HTMLCollection.h |
index 16b57382f8e5be98a31994a0ccd104b91dfb8436..4f6d52a467a501c0402f0784c8d0a8aa38677569 100644 |
--- a/Source/core/html/HTMLCollection.h |
+++ b/Source/core/html/HTMLCollection.h |
@@ -43,6 +43,7 @@ public: |
static PassRefPtr<HTMLCollection> create(ContainerNode& base, CollectionType); |
virtual ~HTMLCollection(); |
virtual void invalidateCache(Document* oldDocument = 0) const OVERRIDE; |
+ void invalidateCacheForAttribute(const QualifiedName*) const; |
// DOM API |
unsigned length() const { return m_collectionIndexCache.nodeCount(*this); } |
@@ -140,10 +141,18 @@ private: |
const unsigned m_shouldOnlyIncludeDirectChildren : 1; |
mutable OwnPtr<NamedItemCache> m_namedItemCache; |
mutable CollectionIndexCache<HTMLCollection, Element> m_collectionIndexCache; |
- |
- friend class LiveNodeListBase; |
}; |
+DEFINE_TYPE_CASTS(HTMLCollection, LiveNodeListBase, collection, isHTMLCollectionType(collection->type()), isHTMLCollectionType(collection.type())); |
+ |
+inline void HTMLCollection::invalidateCacheForAttribute(const QualifiedName* attrName) const |
+{ |
+ if (!attrName || shouldInvalidateTypeOnAttributeChange(invalidationType(), *attrName)) |
+ invalidateCache(); |
+ else if (*attrName == HTMLNames::idAttr || *attrName == HTMLNames::nameAttr) |
+ invalidateIdNameCacheMaps(); |
+} |
+ |
} // namespace |
#endif |