[csswg-drafts] [css-selectors][css-escape] Cannot select attributes with multiple escaped chars (#4820)

apollolux has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-selectors][css-escape] Cannot select attributes with multiple escaped chars ==
Hello! As someone who isn't part of the WG I wasn't sure where to report the issue so this looked like a reasonable place to do so.

I recently had occasion to want to select an HTML element with an attribute that has a Windows-formatted file path as its main content (i.e. backslash directory separators and a colon separating drive letter and the rest of the path). [I asked on Stack Overflow](https://stackoverflow.com/q/59537249/402692) if it was possible, as I was using JavaScript to `querySelector` it and all my attempts to escape the backslashes and colon, either using `CSS.escape` or manually, have failed beyond the first escaped char. Microsoft Visual Studio Code, when on Windows, is what formats paths Windows-style, while on macOS and *nix paths separate with / and targeting seems okay. Sample element and failed selector (actual HTML from VSCode in the Stack Overflow):

```html
<li data-path="c:\WINDOWS\system32\mspaint.exe">mspaint.exe</li>
```

```css
li[data-path="c\:\\WINDOWS\system32\\mspaint\.exe"]
```

Is there something I'm missing regarding how to escape the attribute, or is it a fruitless endeavor to try to target an attribute that has a Windows-style path in it?

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4820 using your GitHub account

Received on Saturday, 29 February 2020 23:24:06 UTC