Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #28987

Re: <!--

From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Newsgroups comp.lang.javascript
Subject Re: <!--
Date 2015-12-07 20:33 +0100
Organization PointedEars Software (PES)
Message-ID <3162871.iCtvOAfsBC@PointedEars.de> (permalink)
References <comment-20151207122517@ram.dialup.fu-berlin.de> <5333913.KbEaQyBAFF@PointedEars.de>

Show all headers | View raw


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.

Back to comp.lang.javascript | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

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

csiph-web