Closed
Bug 867214
Opened 12 years ago
Closed 12 years ago
let expressions not working in script tags
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: hkBst, Unassigned)
Details
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:20.0) Gecko/20100101 Firefox/20.0
Build ID: 20130423094655
Steps to reproduce:
Create minimal webpage as follows:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<script>
var x = let (y=3) y;
alert(x);
</script>
</head>
</html>
visit this page.
Actual results:
In the web console, it complains: SyntaxError: missing ; before statement.
With slight variations I was able to produce different syntax errors such as: missing (, ReferenceError: let is not defined. All for things that work fine in the console.
Comment 1•12 years ago
|
||
"let" isn't a keyword in bog-standard ECMAScript. So to have let statements, let expressions, and all that, you have to opt into a language version that supports them. (Just making them keywords has broken sites in every case it's been attempted -- once by us, once by JavaScriptCore.) Adding |type="application/javascript; version=1.8"| should (modulo any typos) make let expressions work.
I believe let statements are on a standards track, so at some point we may be able to just expose those unconditionally in strict mode code. (|let| is a reserved keyword in strict mode code, now, if it doesn't have the type= opt-in, so this is safe.) Last I heard let expressions aren't standards-track, so you may never see those without the type= opt-in.
Status: UNCONFIRMED → RESOLVED
Closed: 12 years ago
Resolution: --- → INVALID
| Reporter | ||
Comment 2•12 years ago
|
||
Jeff, thanks for clarifying!
Status: RESOLVED → UNCONFIRMED
Resolution: INVALID → ---
Updated•12 years ago
|
Status: UNCONFIRMED → RESOLVED
Closed: 12 years ago → 12 years ago
OS: Linux → All
Hardware: x86_64 → All
Resolution: --- → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•