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

Less fails to parse values from web platform tests: #3396

Open
matthew-dean opened this issue May 21, 2019 · 4 comments
Open

Less fails to parse values from web platform tests: #3396

matthew-dean opened this issue May 21, 2019 · 4 comments

Comments

@matthew-dean
Copy link
Member

matthew-dean commented May 21, 2019

According to: https://github.com/web-platform-tests/wpt/blob/master/css/css-variables/test_variable_legal_values.html

...Less should be able to parse a block like this for custom properties:

legal css variable values {
  --percentage: 25%;
  --number: 37;
  --length: 12em;
  --time: 75ms;
  --function: foo();
  --nested-function: foo(bar());
  --parentheses: ( );
  --braces: { };
  --brackets: [ ];
  --at-keyword-unknown: @foobar;
  --at-keyword-known: @media;
  --at-keyword-unknown-block: @foobar {};
  --at-keyword-known-block: @media {};
  --cdo-at-top-level: <!--;
  --cdc-at-top-level: -->;
  --semicolon-not-top-level: (;);
  --cdo-not-top-level: (<!--);
  --cdc-not-top-level: (-->);
}

However, as expected, Less fails with the at-keywords in custom properties (variable @foobar is undefined). Since custom property parsing is already permissive with logic for failing over (accepting almost anything until a closing outer semi-colon), it makes sense to allow "variable-like" values in custom properties to pass-through.

Thoughts?

@TheJaredWilcurt
Copy link

Fails on all of these:

--at-keyword-unknown: @foobar;
--at-keyword-known: @media;
--at-keyword-unknown-block: @foobar {};
--at-keyword-known-block: @media {};

according to http://lesscss.org/less-preview

@matthew-dean
Copy link
Member Author

matthew-dean commented Aug 9, 2019

This also fails but should succeed, according to custom property documentation:

.box {
  --width: ; // should succeed, according to W3C documentation
  --width:;  // should fail, according to W3C documentation
}

Even though this succeeds:

.box {
  width: ;
}

Note that the W3C actually notes that prop:; has a different value from prop: ;, but Less outputs the same value for each (prop: ;), which seems technically incorrect.

Side note: I'm note sure if this should be supported in Less or not, as I'm not sure of the practical application (dummy placeholder props?). Just noting that it doesn't pass the spec in this regard. This part needs some other input from @less/core.

@stale
Copy link

stale bot commented Dec 7, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Dec 7, 2019
@TheJaredWilcurt
Copy link

anti-stale

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

No branches or pull requests

2 participants