Per our June 2013 resolution (recorded in #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:
<!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>
Per our June 2013 resolution (recorded in #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: