Skip to content
This repository has been archived by the owner on Jan 14, 2021. It is now read-only.

Document common violation of “EscapeSequence 0 [lookahead ∉ DecimalDigit]” #12

Closed
mathiasbynens opened this issue Jun 8, 2013 · 3 comments

Comments

@mathiasbynens
Copy link
Member

See https://mail.mozilla.org/pipermail/es-discuss/2013-June/031149.html and https://bugs.ecmascript.org/show_bug.cgi?id=1553. /cc @Constellation

@mathiasbynens
Copy link
Member Author

Added some tests here: https://mathias.html5.org/tests/javascript/string/ (see the last two tests)

@mathiasbynens
Copy link
Member Author

From https://bugs.ecmascript.org/show_bug.cgi?id=1553#c2:

Behaviour for noctal escapes in strict-mode is different across engines, e.g.
the proposed tests only work in V8 and Presto, other engines report a
strict-mode error (SpiderMonkey/JSC/IE).

EscapeSequence with leading "0":
- sloppy mode
=> accepted in major engines as "\08" == "\0" + "8"

- strict mode
=> accepted in V8/Presto as "\08" == "\0" + "8"
=> SyntaxError in IE/JSC/SpiderMonkey


EscapeSequence without leading "0":
- sloppy mode
=> accepted in major engines as "\8" == "8"

- strict mode
=> accepted in IE/SpiderMonkey/V8/Presto as "\8" == "8"
=> SyntaxError in JSC


OctalInteger
- sloppy mode
=> accepted in major engines as 08 == 8
=> Note: SpiderMonkey reports warning in shell

- strict mode
=> accepted in IE/Presto/JSC/V8 as 08 == 8
=> SyntaxError in SpiderMonkey

@mathiasbynens
Copy link
Member Author

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants