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

Unified Diff: third_party/WebKit/Source/core/css/SelectorChecker.cpp

Issue 2490393002: Match camelCased SVG attributes selectors in html documents. (Closed)
Patch Set: Rebased and fixed return statement Created 4 years, 1 month 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: third_party/WebKit/Source/core/css/SelectorChecker.cpp
diff --git a/third_party/WebKit/Source/core/css/SelectorChecker.cpp b/third_party/WebKit/Source/core/css/SelectorChecker.cpp
index 532dfd82e3911facd01cfd03ee3f0c5717e3415c..36d3952b711165a0224cb985553c53dbc498832e 100644
--- a/third_party/WebKit/Source/core/css/SelectorChecker.cpp
+++ b/third_party/WebKit/Source/core/css/SelectorChecker.cpp
@@ -559,8 +559,17 @@ static bool anyAttributeMatches(Element& element,
AttributeCollection attributes = element.attributesWithoutUpdate();
for (const auto& attributeItem : attributes) {
- if (!attributeItem.matches(selectorAttr))
- continue;
+ if (!attributeItem.matches(selectorAttr)) {
+ if (element.isHTMLElement() || !element.document().isHTMLDocument())
+ continue;
+ // Non-html attributes in html documents are normalized to their camel-
+ // cased version during parsing if applicable. Yet, attribute selectors
+ // are lower-cased for selectors in html documents. Compare the selector
+ // and the attribute local name insensitively to e.g. allow matching SVG
+ // attributes like viewBox.
+ if (!attributeItem.matchesCaseInsensitive(selectorAttr))
+ continue;
+ }
if (attributeValueMatches(attributeItem, match, selectorValue,
caseSensitivity))
« no previous file with comments | « third_party/WebKit/LayoutTests/svg/css/viewBox-attribute-selector.html ('k') | third_party/WebKit/Source/core/dom/Attribute.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698