New issue
Advanced search Search tips

Issue 725773 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: May 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

getElementsByClassName() matches incorrect elements in quirks mode

Project Member Reported by tkent@chromium.org, May 24 2017

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="&#x212a;">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)

 

Comment 1 by tkent@chromium.org, May 24 2017

Owner: tkent@chromium.org
Status: Started (was: Available)
Project Member

Comment 2 by bugdroid1@chromium.org, 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="&#x212a;".  It should match only to class="&#x212a;".

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

Comment 3 by tkent@chromium.org, May 24 2017

Labels: M-60
Status: Fixed (was: Started)

Sign in to add a comment