Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Case insensitive attribute selector is escaped incorrectly #1530

Open
Merri opened this issue Oct 18, 2023 · 1 comment
Open

[Bug]: Case insensitive attribute selector is escaped incorrectly #1530

Merri opened this issue Oct 18, 2023 · 1 comment
Labels

Comments

@Merri
Copy link

Merri commented Oct 18, 2023

Describe the bug

Given this selector: [data--~="is½" i] {}

Used with HTML like this: <span data--="myThing is½"> or <span data--="MYTHING IS½">.

The processed output selector [data--~=is\BD i] {} will not match due to lacking whitespace.

That output is understood as equivalent of [data--~="is½i"]. Notice the letter i has moved from outside the quotes to inside.

Expected behaviour

The selector should match even after processing.

So either don't escape the ½ and other similar characters, or add one extra whitespace to the output after the escape sequence so that the insensitivity indicator doesn't get understood as part of the string: [data--~=is\BD i] {}

Just in case it isn't obvious; two space characters are required to keep the insensitivity indicator separate.

Steps to reproduce

Run minify with any CSS file that has ½ (or other special character) as the last character of a case insensitive attribute selector.

Version

6.0.1

Preset

(no preset)

Environment

System:
    OS: Windows 10 10.0.19045
    CPU: (16) x64 AMD Ryzen 7 4800HS with Radeon Graphics
    Memory: 6.94 GB / 15.42 GB

Package details

+-- cssnano@6.0.1
| +-- cssnano-preset-default@6.0.1
| | +-- css-declaration-sorter@6.4.1
| | | `-- postcss@8.4.29 deduped
| | +-- cssnano-utils@4.0.0
| | | `-- postcss@8.4.29 deduped
| | +-- postcss-calc@9.0.1
| | | `-- postcss@8.4.29 deduped
| | +-- postcss-colormin@6.0.0
| | | `-- postcss@8.4.29 deduped
| | +-- postcss-convert-values@6.0.0
| | | `-- postcss@8.4.29 deduped
| | +-- postcss-discard-comments@6.0.0
| | | `-- postcss@8.4.29 deduped
| | +-- postcss-discard-duplicates@6.0.0
| | | `-- postcss@8.4.29 deduped
| | +-- postcss-discard-empty@6.0.0
| | | `-- postcss@8.4.29 deduped
| | +-- postcss-discard-overridden@6.0.0
| | | `-- postcss@8.4.29 deduped
| | +-- postcss-merge-longhand@6.0.0
| | | +-- postcss@8.4.29 deduped
| | | `-- stylehacks@6.0.0
| | |   `-- postcss@8.4.29 deduped
| | +-- postcss-merge-rules@6.0.1
| | | `-- postcss@8.4.29 deduped
| | +-- postcss-minify-font-values@6.0.0
| | | `-- postcss@8.4.29 deduped
| | +-- postcss-minify-gradients@6.0.0
| | | `-- postcss@8.4.29 deduped
| | +-- postcss-minify-params@6.0.0
| | | `-- postcss@8.4.29 deduped
| | +-- postcss-minify-selectors@6.0.0
| | | `-- postcss@8.4.29 deduped
| | +-- postcss-normalize-charset@6.0.0
| | | `-- postcss@8.4.29 deduped
| | +-- postcss-normalize-display-values@6.0.0
| | | `-- postcss@8.4.29 deduped
| | +-- postcss-normalize-positions@6.0.0
| | | `-- postcss@8.4.29 deduped
| | +-- postcss-normalize-repeat-style@6.0.0
| | | `-- postcss@8.4.29 deduped
| | +-- postcss-normalize-string@6.0.0
| | | `-- postcss@8.4.29 deduped
| | +-- postcss-normalize-timing-functions@6.0.0
| | | `-- postcss@8.4.29 deduped
| | +-- postcss-normalize-unicode@6.0.0
| | | `-- postcss@8.4.29 deduped
| | +-- postcss-normalize-url@6.0.0
| | | `-- postcss@8.4.29 deduped
| | +-- postcss-normalize-whitespace@6.0.0
| | | `-- postcss@8.4.29 deduped
| | +-- postcss-ordered-values@6.0.0
| | | `-- postcss@8.4.29 deduped
| | +-- postcss-reduce-initial@6.0.0
| | | `-- postcss@8.4.29 deduped
| | +-- postcss-reduce-transforms@6.0.0
| | | `-- postcss@8.4.29 deduped
| | +-- postcss-svgo@6.0.0
| | | `-- postcss@8.4.29 deduped
| | +-- postcss-unique-selectors@6.0.0
| | | `-- postcss@8.4.29 deduped
| | `-- postcss@8.4.29 deduped
| `-- postcss@8.4.29 deduped
+-- postcss-cli@10.1.0
| +-- postcss-load-config@4.0.1
| | `-- postcss@8.4.29 deduped
| +-- postcss-reporter@7.0.5
| | `-- postcss@8.4.29 deduped
| `-- postcss@8.4.29 deduped
`-- postcss@8.4.29

Additional context

No response

@ludofischer
Copy link
Collaborator

Definitely a bug here, but the selector is hopefully fairly unusual.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants