Starting a script block with <!--

Hi

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.

Sincerely

Herman Venter

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