postcss-selector-parser icon indicating copy to clipboard operation
postcss-selector-parser copied to clipboard

`lossless: true` option does not preserve trailing spaces in selectors

Open ryo-manba opened this issue 1 year ago • 1 comments

When using the loseless: true option trailing spaces are removed unexpectedly, even though should be preserved.

Related to https://github.com/stylelint/stylelint/pull/8074#discussion_r1817680694

Code to Reproduce

const parser = require('postcss-selector-parser');
const selector = ':not(a, )';

console.log('selector:', selector);
parser((selectors) => {
  console.log('parsed:', selectors.toString());
})
  .process(selector, { lossless: true })

Expected

selector: :not(a, )
parsed: :not(a, )

Actual

selector: :not(a, )
parsed: :not(a,)

ryo-manba avatar Oct 28 '24 14:10 ryo-manba

@ryo-manba pr welcome

alexander-akait avatar Oct 30 '24 13:10 alexander-akait