Re: How to outsource Javascript code from html code ?
In article <y7sAS9EsND9$Ew 4C@merlyn.demon .co.uk>, Dr John Stockton
<spam@merlyn.de mon.co.uk> writes:
[color=blue][color=green]
>>1) The "html comments" are not needed in any browser less than 10 years old.
>>2) They are not "html comments", they are part of the script block and as[/color]
>such[color=green]
>>are part of the script.[/color]
>
>A) They may be useful if the page is being processed by software other
>than a browser.[/color]
Agreed that they may be useful in software other than a browser. But that still
doesn't change the content type of a script block.
[color=blue]
>B) They are HTML comments, since they are for use when the script tag is
>not recognised.[/color]
Leads to a discussion not long ago (Nov 9, 2003) about whether they are HTML
comments or part of the script block. To quote Jim Ley:
<quote>
[color=blue][color=green]
>> That's a javascript comment, not an HTML one, and it can cause no harm
>> (in XHTML things are different of course)[/color]
>
>The string "<!--" begins an HTML comment.[/color]
The content model of SCRIPT is CDATA - you're not allowed comments
inside it, therefore that must be part of the script, and passed to
the script engine. Certainly it's not part of ECMAScript, but that is
not an HTML comment - they're not legal inside SCRIPT blocks (this is
the change with XHTML of course where the content model of script
changed to PCDATA which allows comments.)
It's either a javascript comment, or something that the javascript
engine accepts as if it was a comment - it's passed as is via the HTML
parser.
Jim.
</quote>
So, they are part of the script block, and not an HTML comment.
--
Randy
In article <y7sAS9EsND9$Ew 4C@merlyn.demon .co.uk>, Dr John Stockton
<spam@merlyn.de mon.co.uk> writes:
[color=blue][color=green]
>>1) The "html comments" are not needed in any browser less than 10 years old.
>>2) They are not "html comments", they are part of the script block and as[/color]
>such[color=green]
>>are part of the script.[/color]
>
>A) They may be useful if the page is being processed by software other
>than a browser.[/color]
Agreed that they may be useful in software other than a browser. But that still
doesn't change the content type of a script block.
[color=blue]
>B) They are HTML comments, since they are for use when the script tag is
>not recognised.[/color]
Leads to a discussion not long ago (Nov 9, 2003) about whether they are HTML
comments or part of the script block. To quote Jim Ley:
<quote>
[color=blue][color=green]
>> That's a javascript comment, not an HTML one, and it can cause no harm
>> (in XHTML things are different of course)[/color]
>
>The string "<!--" begins an HTML comment.[/color]
The content model of SCRIPT is CDATA - you're not allowed comments
inside it, therefore that must be part of the script, and passed to
the script engine. Certainly it's not part of ECMAScript, but that is
not an HTML comment - they're not legal inside SCRIPT blocks (this is
the change with XHTML of course where the content model of script
changed to PCDATA which allows comments.)
It's either a javascript comment, or something that the javascript
engine accepts as if it was a comment - it's passed as is via the HTML
parser.
Jim.
</quote>
So, they are part of the script block, and not an HTML comment.
--
Randy
Comment