less.js icon indicating copy to clipboard operation
less.js copied to clipboard

Less fails to parse values from web platform tests:

Open matthew-dean opened this issue 6 years ago • 4 comments

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?

matthew-dean avatar May 21 '19 19:05 matthew-dean

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

TheJaredWilcurt avatar Jun 05 '19 23:06 TheJaredWilcurt

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.

matthew-dean avatar Aug 09 '19 19:08 matthew-dean

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[bot] avatar Dec 07 '19 22:12 stale[bot]

anti-stale

TheJaredWilcurt avatar Dec 11 '19 15:12 TheJaredWilcurt