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

Most CSS keywords, functions,... are case insensitive #3316

Closed
romainmenke opened this issue Aug 15, 2023 · 1 comment
Closed

Most CSS keywords, functions,... are case insensitive #3316

romainmenke opened this issue Aug 15, 2023 · 1 comment

Comments

@romainmenke
Copy link

romainmenke commented Aug 15, 2023

https://github.com/romainmenke/css-import-tests/blob/main/tests/001-core-features/case-sensitivity/001/style.css#L2

Browsers don't distinguish between

  • @IMPORT url("a.css");
  • @import url("a.css");

But this is not a lowercase match.

esbuild currently ignores @IMPORT and treats @import 'foo.css' LAYER SUPPORTS(display: grid) as media conditions.

I am only testing @import, but maybe there are other parts of esbuild that also need to handle keywords as case insensitive?


Difference between case insensitive and lower case match :

// Not a regular 'K'
`blacK`.toLowerCase() === 'black' 
// true

/black/i.test(`blacK`)
// false

this might be obvious, but there are numerous bugs in PostCSS plugins because of this difference :)

@evanw evanw closed this as completed in e48baa3 Sep 13, 2023
@romainmenke
Copy link
Author

Works now! Awesome!


I don't think my earlier comment about case insensitivity vs lower case matching was entirely correct.

It seems that somewhere in copy/pasting or maybe GitHub normalizing the specific char was lost.

A gist to generate all possible cases (there is only one) : https://gist.github.com/romainmenke/6a578290b240aa9ba3c6e726ecab96a4

The specific char code that produces the specific K : 8490

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

No branches or pull requests

1 participant