Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #28986 > unrolled thread
| Started by | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| First post | 2015-12-07 15:01 +0100 |
| Last post | 2015-12-08 11:02 +0000 |
| Articles | 3 — 2 participants |
Back to article view | Back to comp.lang.javascript
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: <!-- Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-12-07 15:01 +0100
Re: <!-- Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-12-07 20:33 +0100
Re: <!-- John Harris <niam@jghnorth.org.uk.invalid> - 2015-12-08 11:02 +0000
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2015-12-07 15:01 +0100 |
| Subject | Re: <!-- |
| Message-ID | <5333913.KbEaQyBAFF@PointedEars.de> |
Stefan Ram wrote: > I tried the following with the Firefox console (one line of > input, one line of output, and one blank line is given below): > > < > SyntaxError: expected expression, got '<' > > <! > SyntaxError: expected expression, got '<' > > <!- > SyntaxError: expected expression, got '<' > > <!-- > undefined > > So, when I input arbitrary symbols, it usually gives me a > syntax error. Those are not arbitrary symbols; the first one is an operator that requires two operands. > But when I hit »<!--«, it does not say > »SyntaxError«, but »undefined«. Where is the production in > the grammar of JavaScript that allows this »<!--«? I presume that “<!--”, at least at the beginning of a program, is parsed like “//” in Mozilla JavaScript was built into SpiderMonkey after people abused HTML comments to hide improperly escaped “script” element content from improperly working HTML parsers and the (properly working) W3C Validator. That is one of the syntax extensions allowed by the “Conformance” section of ECMAScript Editions. And so this program is empty; there is no remaining expression, the missing statement gets automatic semicolon insertion for the empty statement (ES 6, § 13.4), and the program’s result is the “undefined” value. See ES 5.1 for the /Program/ production; I could not find it in ES 6. -- PointedEars FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/> Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix> Please do not cc me. / Bitte keine Kopien per E-Mail.
[toc] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2015-12-07 20:33 +0100 |
| Message-ID | <3162871.iCtvOAfsBC@PointedEars.de> |
| In reply to | #28986 |
Thomas 'PointedEars' Lahn wrote: > Stefan Ram wrote: >> I tried the following with the Firefox console (one line of >> input, one line of output, and one blank line is given below): >> […] >> But when I hit »<!--«, it does not say >> »SyntaxError«, but »undefined«. Where is the production in >> the grammar of JavaScript that allows this »<!--«? > > I presume that “<!--”, at least at the beginning of a program, is parsed > like “//” in Mozilla JavaScript was built into SpiderMonkey after people > abused HTML comments to hide improperly escaped “script” element content > from improperly working HTML parsers and the (properly working) W3C > Validator. That is one of the syntax extensions allowed by the > “Conformance” section of ECMAScript Editions. > […] Apparently “<!--” is parsed exactly like “//” on *every* line of a program in Mozilla JavaScript as of Iceweasel 38.1.0 and Google V8 JavaScript as of Chromium 46.0.2490.71, both running under Debian GNU/Linux 8.2 64-bit (console tests). BTW, it is probably not a good idea to develop and to test only with Mozilla JavaScript, as according to StatCounter.com the top 3 of world-wide market shares as of November 2015, all platforms, Chrome and Firefox 5+ combined each, are: Chrome: 44.17 % (Google V8 JavaScript) Firefox 5+: 10.63 % (Mozilla JavaScript 5+) IE 11: 7.00 % (“Internet Explorer JavaScript”, i.e. JScript 11.x) <http://gs.statcounter.com/#all-browser_version_partially_combined-ww-monthly-201411-201511-bar> See also <http://PointedEars.de/es-matrix/#environments> (whose display I need to improve). -- PointedEars FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/> Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix> Please do not cc me. / Bitte keine Kopien per E-Mail.
[toc] | [prev] | [next] | [standalone]
| From | John Harris <niam@jghnorth.org.uk.invalid> |
|---|---|
| Date | 2015-12-08 11:02 +0000 |
| Message-ID | <14ed6blcbfgukpdsbhsgu8iqcoea7q3ncc@4ax.com> |
| In reply to | #28986 |
On Mon, 07 Dec 2015 15:01:45 +0100, Thomas 'PointedEars' Lahn <PointedEars@web.de> wrote: <snip> >See ES 5.1 for >the /Program/ production; I could not find it in ES 6. In ECMAScript 2015 (its official name) the 'program' production has been replaced by the two productions 'script' and 'module' (see section 5.1.4). John
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.javascript
csiph-web