On Thu, 26 Apr 2007 10:26:41 +1000, Andrew Harris wrote:
> 'morning all,
>
> It is common and often recommended practice to comment javascript placed in a 
> document.
>
> <script type="text/javascript" language="javascript"> <!-- myVariable = 
> 'woo'; // -->
> </script>
>
Netscape 2 introduced JavaScript (Livescript) in 1995. Netscape 1 did not 
recognize the SCRIPT tags, and rendered the script on screen. Hence
the need, back then, for the HTML comments.

Only needed today if you wish to support Netscape 1.

>
> While I'm on the topic - what about the whole <![CDATA[ ... ]]> thing? Should 
> I be
> using that? What are the possible consequences of ignoring it like the vast 
> majority of
> page authors?

CDATA sections are required for embedded code only for XHTML.
If your file names end in .htm, .html, .php etc. then every browser
in the world will treat your "XHTML" as poorly marked up HTML.

XHTML markup works because, unlike XHTML, HTML is required to be 
forgiving of minor errors and several omissions.

If you use a "strict" XHTML DOCTYPE, you can check out the
consequences of various markup options by saving a local copy
of your page with a .xhtml extension instead of .html. Opera and
Firefox on Windows, at least, will treat this as "real" XHTML.

Cordially,
David
--



*******************************************************************
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
*******************************************************************

Reply via email to