getElementsByClassName() matches incorrect elements in quirks mode |
||
Issue description
Chrome Version: 60 Canary
OS: All but iOS
What steps will reproduce the problem?
(1) Open the following HTML
<!-- quirks mode -->
<style>
.\212a:after {
content: " (CSS matched)";
color: red;
}
</style>
<body>
<div class="k">ascii k</div>
<div class="K">ascii K</div>
<div class="K">U+212A</div>
<script>
var nodes = document.getElementsByClassName('\u212a');
for (var i = 0; i < nodes.length; ++i) {
nodes[i].appendChild(document.createTextNode(' (gEBCN matched)'));
}
</script>
</body>
What is the expected result?
The page shows:
ascii k
ascii K
U+212A (gEBCN matched) (CSS matched)
What happens instead?
Chrome 60 shows:
ascii k (gEBCN matched)
ascii K (gEBCN matched)
U+212A (CSS matched)
Please use labels and text to provide additional information.
Safari and Firefox show the expected result. Edge shows:
ascii k (CSS matched)
ascii K (CSS matched)
U+212A (gEBCN matched) (CSS matched)
,
May 24 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/7b451a789df9be84623fc114a4efe00f5e9dbb5e commit 7b451a789df9be84623fc114a4efe00f5e9dbb5e Author: tkent <tkent@chromium.org> Date: Wed May 24 08:51:03 2017 DOM: Fix an incorrect result of getElementsByClassName() in quirks mode. document.getElementsByClassName('\u212a') matched to class="k" and class="K", and did not match to class="K". It should match only to class="K". Element::ClassNames() stores ASCII-lower class string, however getElementsByClassName() applied FoldCase(). Also, this CL removes a unused data member of ClassCollection. BUG= 725773 ,627682 Review-Url: https://codereview.chromium.org/2899243003 Cr-Commit-Position: refs/heads/master@{#474217} [modify] https://crrev.com/7b451a789df9be84623fc114a4efe00f5e9dbb5e/third_party/WebKit/LayoutTests/external/wpt/dom/nodes/getElementsByClassName-14.htm [modify] https://crrev.com/7b451a789df9be84623fc114a4efe00f5e9dbb5e/third_party/WebKit/Source/core/dom/ClassCollection.cpp [modify] https://crrev.com/7b451a789df9be84623fc114a4efe00f5e9dbb5e/third_party/WebKit/Source/core/dom/ClassCollection.h
,
May 24 2017
|
||
►
Sign in to add a comment |
||
Comment 1 by tkent@chromium.org
, May 24 2017Status: Started (was: Available)