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

Parser bug #63

Closed
Panthevm opened this issue Feb 13, 2021 · 7 comments
Closed

Parser bug #63

Panthevm opened this issue Feb 13, 2021 · 7 comments
Assignees
Labels

Comments

@Panthevm
Copy link

When forming a CSSDeclaration, the .getProperty is always formed in lowercase.

This error is critical when we are dealing with variables.

--A != --a

And when call .getExpressionAsCSSString, the case is respected, as a result, we lose the relationship

Reproducing an error: https://jsfiddle.net/dauhk27r/

@phax phax self-assigned this Feb 13, 2021
@phax phax added the bug label Feb 13, 2021
@phax
Copy link
Owner

phax commented Feb 14, 2021

Quote from https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties

Note: Custom property names are case sensitive — --my-color will be treated as a separate custom property to --My-color.

phax added a commit that referenced this issue Feb 24, 2021
@phax
Copy link
Owner

phax commented Feb 24, 2021

I created a test case with your example, where I am reading and re-emitting the file. The output is

body {
  --a:red;
  background-color:var(--A);
}

so that looks good to me.
When calling expression.getAsCSSString() I also get it in the right casing.

@Panthevm
Copy link
Author

Panthevm commented Feb 25, 2021

Quote from https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties

Note: Custom property names are case sensitive — --my-color will be treated as a separate custom property to --My-color.

I apparently did not explain the problem well.

You quoted above that variable names are case sensitive, but your reader will always format them in lower case.

And as a result, you get what you brought in the tests - not valid css, since there is no --A variable. since its parser brought it to lower case

@Panthevm
Copy link
Author

Panthevm commented Feb 25, 2021

Input:

body {
  --A:red;
  background-color:var(--A);
}

Output:

body {
  --a:red;
  background-color:var(--A);
}

var(--A) - variable --A not found

@phax
Copy link
Owner

phax commented Feb 25, 2021

@Panthevm thanks for the clarification - now I understand. Will keep you posted

phax added a commit that referenced this issue Feb 25, 2021
@phax
Copy link
Owner

phax commented Feb 25, 2021

Found and resolved. Will be part of the 6.2.4 release.
Thanks for pointing that out!

Do you have any other issue in the pipeline or can I start building a release?

@Panthevm
Copy link
Author

There are no other problems. Many thanks!

@phax phax closed this as completed Feb 25, 2021
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