New issue
Advanced search Search tips

Issue 680139 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Apr 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug



Sign in to add a comment

DevTools: Copy selector produces invalid selector when it starts with a double hyphen

Reported by ovkadu...@gmail.com, Jan 11 2017

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2978.0 Safari/537.36

Steps to reproduce the problem:
1. Go to https://jsfiddle.net/ovkadurin/71dud8Lh/
2. Open DevTools, open Elements panel
3. Select the div that has css class "--area"
4. Right click -> copy -> copy selector
5. Paste in anywhere. Its value is "body > div > div > div.\2d -area" which is invalid selector.

What is the expected behavior?
Selector should be "body > div > div > div.--area"

What went wrong?
Wrong selector

Did this work before? N/A 

Chrome version: 57.0.2978.0  Channel: canary
OS Version: 10.0
Flash Version: Shockwave Flash 24.0 r0
 

Comment 1 by woxxom@gmail.com, Jan 11 2017

FWIW, as per CSS specification [1], if the first character is a hyphen, the second character MUST be a letter or underscore. Thus two hyphens at start is an invalid class name. Chrome allows it, however, in order not break some sites that violate the specification.

  [1]: https://www.w3.org/TR/CSS21/grammar.html#scanner - look at the "ident" rule 

Comment 2 by alph@chromium.org, Jan 11 2017

Owner: lushnikov@chromium.org
Leave it to lusha to decide if we want to implement it. 

Comment 3 by ajha@chromium.org, Jan 16 2017

Labels: M-57

Comment 4 by hdodda@chromium.org, Jan 25 2017

@lushnikov-- Could you please provide us any update on this . 

Thanks!
@lushnikov - Ping! could you please let us know is there any latest update available for this issue?

Thanks!
Owner: l...@chromium.org
Status: Assigned (was: Unconfirmed)
Let's fix this. Eric, could you please take a look?
Project Member

Comment 7 by bugdroid1@chromium.org, Apr 20 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/188903bc2a2e56080286ad0970605d590feffbb7

commit 188903bc2a2e56080286ad0970605d590feffbb7
Author: luoe <luoe@chromium.org>
Date: Thu Apr 20 01:37:56 2017

DevTools: recognize CSSIdentifiers that start with double hyphen

The CSS parser actually recognizes invalid CSSIdentifiers such as "--foo", even
though this differs from the spec. This CL let's DevTools recognize these as
selectors starting with "--" as identifiers that do not need escaping.

BUG= 680139 

Review-Url: https://codereview.chromium.org/2830773002
Cr-Commit-Position: refs/heads/master@{#465851}

[modify] https://crrev.com/188903bc2a2e56080286ad0970605d590feffbb7/third_party/WebKit/LayoutTests/inspector/elements/elements-css-path-expected.txt
[modify] https://crrev.com/188903bc2a2e56080286ad0970605d590feffbb7/third_party/WebKit/LayoutTests/inspector/elements/elements-css-path.html
[modify] https://crrev.com/188903bc2a2e56080286ad0970605d590feffbb7/third_party/WebKit/Source/devtools/front_end/components/DOMPresentationUtils.js

Comment 8 by l...@chromium.org, Apr 20 2017

Status: Fixed (was: Assigned)
Summary: DevTools: Copy selector produces invalid selector when it starts with a double hyphen (was: Copy selector produces invalid selector)

Sign in to add a comment