[thelist] Javascript newbie - errors

Andrew Clover and-evolt at doxdesk.com
Mon Oct 27 06:32:56 CST 2003


Jeff Howden <jeff at jeffhowden.com> wrote:

> speaking of comments within <style> and <script> blocks, is there a place
> online that does a definitive breakdown of when to use and not to use
> comments, what kind (regular html vs w/ cdata notations), etc.?

 Compatibility      Can block     Solution  Other sequences
 HTML  HTML  XHTML  contain char            that shouldn't be
 <3.2  >=4          '<' or '&'              used in block

 No    Yes   No     Yes           1         </
 No    Yes   Yes    No            1         </
 Yes   Yes   No     Yes           2         </ --
 No    Yes   Yes    Yes           3         </ ]]>
 Yes   Yes   Yes    Yes           4         </ -- ]]>


1. <script type="text/javascript"> ... </script>
   <style type="text/css"> ... </style>
2. <script type="text/javascript"><!-- ... //--></script>
   <style type="text/css"><!-- ... --></style>
3. <script type="text/javascript">/*<![CDATA[*/ ... /*]]>*/</script>
   <style type="text/css">/*<![CDATA[*/ ... /*]]>*/</style>
4. <script type="text/javascript"><!--//--><![CDATA[//><!-- 
     ...
   //--><!]]></script>
   <style type="text/css"><!--/*--><![CDATA[/*><!--*/ 
     ...
   /*]]>*/--></style>

Embedding starts to look unattractive when reaching solution 4...

-- 
Andrew Clover
mailto:and at doxdesk.com
http://www.doxdesk.com/


More information about the thelist mailing list