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

Unified Diff: third_party/WebKit/Source/core/html/HTMLCollection.cpp

Issue 1889793005: Make "document.anchors" return anchors with "id" attribute also (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/dom/collection-anchor-id-getter.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/html/HTMLCollection.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLCollection.cpp b/third_party/WebKit/Source/core/html/HTMLCollection.cpp
index 194ae8edd4119b95a938aabbbbe35ac2f52ceda0..c42cae0493a52ab83c46423723777e980dc5974d 100644
--- a/third_party/WebKit/Source/core/html/HTMLCollection.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLCollection.cpp
@@ -141,13 +141,11 @@ static NodeListInvalidationType invalidationTypeExcludingIdAndNameAttributes(Col
// FIXME: We can do better some day.
return InvalidateOnAnyAttrChange;
case DocAnchors:
- return InvalidateOnNameAttrChange;
- case DocLinks:
- return InvalidateOnHRefAttrChange;
- case WindowNamedItems:
- return InvalidateOnIdNameAttrChange;
case DocumentNamedItems:
+ case WindowNamedItems:
return InvalidateOnIdNameAttrChange;
+ case DocLinks:
+ return InvalidateOnHRefAttrChange;
case FormControls:
return InvalidateForFormControls;
case ClassCollectionType:
@@ -233,7 +231,7 @@ static inline bool isMatchingHTMLElement(const HTMLCollection& htmlCollection, c
case DocLinks:
return (element.hasTagName(aTag) || element.hasTagName(areaTag)) && element.fastHasAttribute(hrefAttr);
case DocAnchors:
- return element.hasTagName(aTag) && element.fastHasAttribute(nameAttr);
+ return element.hasTagName(aTag) && (element.fastHasAttribute(nameAttr) || element.fastHasAttribute(idAttr));
case ClassCollectionType:
case TagCollectionType:
case HTMLTagCollectionType:
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/dom/collection-anchor-id-getter.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698