ankit / stylebot

Change the appearance of the web instantly
https://stylebot.dev/
MIT License
1.39k stars 206 forks source link

[Bug] Broken highlighting when using URLs in attribute selectors #666

Open waldyrious opened 2 years ago

waldyrious commented 2 years ago

Describe the bug

When using attribute selectors that contain URLs, the URL is highlighted as if it were a CSS property (separated at the : character), and the highlighting seems to become broken afterwards:

This code:

img[src$="http://www.example.com/"], span[title="foobar"] {
  display: none;
}

img[style*="width:150px"], span[title="foobar"] {
  display: none;
}

...is highligted like this:

Screenshot from 2021-09-03 11-11-30

Compare with:

CodeMirror Monaco
Screenshot from 2021-09-03 11-11-46 Screenshot from 2021-09-03 11-12-01

Browser

Tested in Chromium-based (Brave) and Firefox.

To Reproduce

Steps to reproduce the behavior:

Expected behavior

I'd expect the URL to be treated as a string. In fact, I don't think any attribute selector value, other than those for the style attribute (e.g. span[style="padding:2em"]) to be highlighted as css key-value properties.

Screenshots

Added above.

Additional context

N/A.