W3C home > Mailing lists > Public > public-html-comments@w3.org > March 2010

Starting a script block with <!--

From: Herman Venter <hermanv@microsoft.com>
Date: Sat, 20 Mar 2010 21:17:23 +0000
To: "public-html-comments@w3.org" <public-html-comments@w3.org>
Message-ID: <BAB781858DF25C488FD24AF239E418E016523A6F@TK5EX14MBXC115.redmond.corp.microsoft.com>

I'm working on a prototype HTML5 parser for research purposes and recently bumped into this little bit of markup:

<SCRIPT type=text/javascript><!-- site js --></SCRIPT>

Trawling around the Web it seems that the expectation is that the script engine will ignore a (first?) line starting with <!--.

The EcmaScript standard does not provide for this (at least not the last time I've read through it), so I thought perhaps the issue will be addressed in the new HTML5 standard.

However, looking at the latter, I find myself hopelessly confused about the meaning of the "Script data escape start state" that is entered when <! is encountered inside a script tag body.

As best as I can make things out, the end result is that the HTML comment in the above example is just passed through to the script engine, which leaves the question of what the script engine should do with the non compliant syntax dangling in the air.

I'm also left bemused by the purpose of the "Script data escape start state". Some non normative text the explains the rationale behind this state, amplified by some concrete examples, would be a great improvement to the standard.


Herman Venter
Received on Sunday, 21 March 2010 20:22:09 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:26:26 UTC