GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |
GeezerVison is showing github.com — Keep empty values in the middle and at the start of list.comma() by MahinAnowar · Pull Request #2134 · postcss/postcss Conversation
Contributor
list.comma(',,') // [''] expected ['', '', ''] list.comma(', b') // ['b'] expected ['', 'b'] list.comma('a,, b') // ['a', 'b'] expected ['a', '', 'b'] list.comma('a, b,') // ['a', 'b', ''] already correct Whitespace hides it. list.comma('a,,b') // ['a', 'b'] list.comma('a, ,b') // ['a', '', 'b']
let rule = postcss.parse('a,,b{}').first rule.selectors // ['a', 'b'] rule.selectors = rule.selectors rule.toString() // 'a,b{}' This is the same thing #2129 fixed for The changeOne condition. if (split) {
- if (current !== '') array.push(current.trim())
+ if (last || current !== '') array.push(current.trim())
TestsFour cases in
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionssplit() only pushed an item at a separator when it had collected some
text, so an empty value was dropped unless it happened to be the last
one. list.comma(',,') returned [''] instead of ['', '', ''].
Whitespace hid the inconsistency: 'a, ,b' collects ' ', which is not
empty, so it survives and is then trimmed to ''. That makes the result
depend on the spacing rather than the number of commas:
list.comma('a,,b') // ['a', 'b']
list.comma('a, ,b') // ['a', '', 'b']
Rule#selectors reads through list.comma, so 'a,,b' reported two
selectors and assigning them back rewrote the rule as 'a,b'.
The `last` flag already marks the separator as significant, which is
what comma() passes and space() does not, so it is the right condition
here too. Runs of whitespace still collapse for space().
Uh oh!
There was an error while loading. Please reload this page.
|
There was an error while loading. Please reload this page.
|
Thanks. I hope it would not break something |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.