A
Asen Bozhilov
Documentation permit to be used `\UnicodeEscapeSequence` in
IdentifierName. But there:
| Unicode escape sequences are also permitted in identifiers,
| where they contribute a single character to the
| identifier, as computed by the CV of the
| UnicodeEscapeSequence. The \ preceding the
| UnicodeEscapeSequence does not contribute a character to the
identifier.
| A UnicodeEscapeSequence cannot be
| used to put a character into an identifier that
| would otherwise be illegal. In other words, if a
\UnicodeEscapeSequence
| sequence were replaced by its UnicodeEscapeSequence's CV,
| the result must still be a
| valid Identifier that has the exact same sequence of characters as
the original Identifier.
As i understand it. If i type:
var \\u0069\\u0066; //var if;
`if` is ReservedWord and example above, should throw SyntaxError.
try {
eval('var \\u0069\\u0066;'); //var if;
}catch(e) {
window.alert(e instanceof SyntaxError);
}
Firefox 3.5.7 - No error
IE6 - true
Chrome 4.0 - No error
Opera 9.64 - No error
Safari 4.0 - No error
Rhino 1.7R2 - No error
DMDScript 1.02 - true
try {
eval('var \\u0030;'); //var 0;
}catch (e) {
window.alert(e instanceof SyntaxError);
}
Firefox 3.5.7 - true
IE6 - true
Chrome 4.0 - true
Opera 9.64 - No error
Safari 4.0 - true
Rhino 1.7R2 - No error
DMDScript 1.02 - No error
My question is, what is the proper behavior related with
specification? I think if i have `var \\u0069\\u0066;` should throw
SyntaxError.
Thanks.
IdentifierName. But there:
| Unicode escape sequences are also permitted in identifiers,
| where they contribute a single character to the
| identifier, as computed by the CV of the
| UnicodeEscapeSequence. The \ preceding the
| UnicodeEscapeSequence does not contribute a character to the
identifier.
| A UnicodeEscapeSequence cannot be
| used to put a character into an identifier that
| would otherwise be illegal. In other words, if a
\UnicodeEscapeSequence
| sequence were replaced by its UnicodeEscapeSequence's CV,
| the result must still be a
| valid Identifier that has the exact same sequence of characters as
the original Identifier.
As i understand it. If i type:
var \\u0069\\u0066; //var if;
`if` is ReservedWord and example above, should throw SyntaxError.
try {
eval('var \\u0069\\u0066;'); //var if;
}catch(e) {
window.alert(e instanceof SyntaxError);
}
Firefox 3.5.7 - No error
IE6 - true
Chrome 4.0 - No error
Opera 9.64 - No error
Safari 4.0 - No error
Rhino 1.7R2 - No error
DMDScript 1.02 - true
try {
eval('var \\u0030;'); //var 0;
}catch (e) {
window.alert(e instanceof SyntaxError);
}
Firefox 3.5.7 - true
IE6 - true
Chrome 4.0 - true
Opera 9.64 - No error
Safari 4.0 - true
Rhino 1.7R2 - No error
DMDScript 1.02 - No error
My question is, what is the proper behavior related with
specification? I think if i have `var \\u0069\\u0066;` should throw
SyntaxError.
Thanks.