Repository navigation
Conversation
8.5.24 restored a leading BOM on stringify. Concatenated CSS and documents with several BOM-tagged roots then contained U+FEFF in the middle of the output. Strip every leading BOM on parse, skip stray markers while tokenizing, and emit at most one BOM when stringifying. Fixes postcss#2133
|
|
||
| function nextToken(opts) { | ||
| if (returned.length) return returned.pop() | ||
| skipBom() |
There was a problem hiding this comment.
Why do we need it if we already have this.css.replace(/^[\uFEFF\uFFFE]+/, '')?
|
@romainmenke found an issue with current approach
But we still can think of removing |
|
I tested Chrome 155 confirms the earlier U+FEFF concern: One remaining Document case: a first root from The failed Node 14 job resolved With locked dependencies, the PR passes all 691 unit tests on Node 10/12/14/16/18/20/22/24/26 and the full |
Why
v8.5.24 started restoring a leading BOM on stringify (#2119). That is correct for a single file, but
parse/stringifycould still produce more than one U+FEFF:a{}\uFEFFb{}) re-emitted the mid-file marker as part of the next selectorDocumentof several BOM-tagged roots wrote a BOM before every rootThose extra markers show up in the middle of generated CSS and break the first rule after each one.
Solution
Input, not only the firstStringifier#rootA single leading BOM is still preserved.
parse('\uFEFFa{}').toString()remains\uFEFFa{}.Fixes #2133