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)) |