[Petal] <![CDATA[ ... ]]> and HTML Elements
Fergal Daly
fergal at esatclear.ie
Tue Nov 9 11:12:47 GMT 2004
On Tue, Nov 09, 2004 at 10:20:09AM +0000, Chris Croome wrote:
> Hi
>
> On Mon 08-Nov-2004 at 04:13:08PM -0500, William McKee wrote:
> >
> > I'd since stopped using the // <!-- // --> comments since they are
> > mostly unnecessary.
>
> They are potentially worse than unnecessary if you are producing
> XHTML:
>
> C.4. Embedded Style Sheets and Scripts
>
> Use external scripts if your script uses < or & or ]]> or --.
> Note that XML parsers are permitted to silently remove the contents
> of comments. Therefore, the historical practice of "hiding" scripts
> and style sheets within "comments" to make the documents backward
> compatible is likely to not work as expected in XML-based user
> agents.
>
> http://www.w3.org/TR/xhtml1/#C_4
This is in the context of creating XHTML that is compatible with HTML. The
first sentence means that you just can't do it if you have < or & ]]> or --
in an in-page script.
XHTML and HTML have incompatible ways of dealing with script tags and you
need to aim at one or the other (or move your scripts into a .js file).
What are these scripts that can't be put in a .js file anyway?
Fergal
More information about the Petal
mailing list