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

Line comments aren't stripped from @supports selector(...)

Open thorn0 opened this issue 5 years ago • 1 comments

Is this a bug or is this an expected behavior?

Demo (Less 3.11.3): https://jsbin.com/hewizek/6/edit?html,js,console

Input:

@supports selector(
  :focus-visible // *"a"
) {
  a { 
    color: red;
  }
}

Output:

@supports selector(
    :focus-visible // *"a") {
  a {
    color: red;
  }
}

Expected:

@supports selector(:focus-visible) {
  a {
    color: red;
  }
}

thorn0 avatar Jul 03 '20 09:07 thorn0

It's expected behavior, although of course not ideal. The @supports tag and some other at-rules that are not explicitly parsed basically allow anything in the at-rule prelude, and just look for matching blocks (like parentheses).

This is being re-worked in a smarter parser for Less v5, but there is no timeline currently for that release.

matthew-dean avatar Jul 13 '20 14:07 matthew-dean