Wednesday, 27 January 2016

Re: Big push on testing needed

>Dave Higton wrote
> My reference suggests that an HTML comment is /not/ a legal Javascript
> comment. Perhaps you should open a discussion with the author of the
> above application. I would, of course, be very interested to know the
> conclusion!

Dave - below is an extract from the
"Ecma Standard definition of the ECMAScript 2015 Language",

Assuming that that JavaScript is entirely defined by the ECMAScript
standard, it seems clear that html style comments are valid.

*****************************************************************
"Annex B (normative) Additional ECMAScript Features for Web Browsers"
...
B.1.3 HTML-like Comments
The syntax and semantics of 11.4 is extended as follows except that
this extension is not when parsing source
code using the goal symbol Module:

Syntax
Comment ::
MultiLineComment
SingleLineComment
SingleLineHTMLOpenComment
SingleLineHTMLCloseComment
SingleLineDelimitedComment

MultiLineComment ::
/* FirstCommentLineopt LineTerminator MultiLineCommentCharsopt
*/ HTMLCloseCommentopt

FirstCommentLine ::
SingleLineDelimitedCommentChars

SingleLineHTMLOpenComment ::
<!-- SingleLineCommentCharsopt

SingleLineHTMLCloseComment ::
LineTerminatorSequence HTMLCloseComment

SingleLineDelimitedComment ::
/* SingleLineDelimitedCommentCharsopt */

HTMLCloseComment ::
WhiteSpaceSequenceopt SingleLineDelimitedCommentSequenceopt -->
SingleLineCommentCharsopt

SingleLineDelimitedCommentChars ::
SingleLineNotAsteriskChar SingleLineDelimitedCommentCharsopt
* SingleLinePostAsteriskCommentCharsopt

SingleLineNotAsteriskChar ::
SourceCharacter but not one of * or LineTerminator

SingleLinePostAsteriskCommentChars ::
SingleLineNotForwardSlashOrAsteriskChar
SingleLineDelimitedCommentCharsopt
* SingleLinePostAsteriskCommentCharsopt

SingleLineNotForwardSlashOrAsteriskChar ::
SourceCharacter but not one of / or * or LineTerminator

WhiteSpaceSequence ::
WhiteSpace WhiteSpaceSequenceopt

SingleLineDelimitedCommentSequence ::
SingleLineDelimitedComment WhiteSpaceSequenceopt
SingleLineDelimitedCommentSequenceopt



Copyright Ecma International 2015

page 523


*****************************************************************

--

No comments:

Post a Comment