[csswg-drafts] [css-syntax] Correctly handle "escaped EOF"

tabatkins has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-syntax] Correctly handle "escaped EOF" ==
Per our June 2013 resolution (recorded in <https://github.com/w3c/csswg-drafts/issues/3174>), the correct way to handle an "escaped EOF" (that is, a stylesheet ending in a `\`) is to produce a U+FFFD, except in strings, where it is ignored.

Currently, Syntax correctly specifies that you ignore an escaped EOF in a string, but for anything else, it ends the current token, then reconsumes the `\` as a fresh token, which ends up producing a DELIM token containing `\`.

It looks like I can't just simply modify that clause in "Consume a token", because implementations don't end the preceding token.

[Test case](http://software.hixie.ch/utilities/js/live-dom-viewer/saved/6237):
```html
<!DOCTYPE html>
<style>.foo {--foo:foo\</style>
<style>.foo {--foo:foo \</style>
<style>.foo {--foo:"foo\</style>
<script>
for(var sheet of document.styleSheets) {
  w(sheet.cssRules[0].cssText);
}
</script>
```

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/3182 using your GitHub account

Received on Friday, 28 September 2018 21:29:15 UTC