RE: Embedded style and style wrappers (RE: New WD: CSS3 selectors)

Chris Lilley wrote:

> >         <STYLE ID="x12"><!--
> >                 /* unrendered declarations here */
> >         --></STYLE>
> >
> > it works in *both* IE5 and Gecko: the contents of STYLE are not
> > rendered, but the rest of the document is, according to the
> > embedded style rules.
>
> Instead of that, use a CDATA marked section like this:
>
> <style ID="x12"><![CDATA[
>         /* unrendered declarations here */
>  ]]>
> </style>
>
> Which does the same thing, but is more correct.

Actually, that was the first thing I tried, but IE displays the STYLE contents
(while accurately styling the other stuff), and Gecko displays *everything* as
straight text.

Incidentally, I have also run into difficulties using embedded SCRIPTs in XHTML
with CDATA sections:

	<script type="text/javascript"><![CDATA[
		alert("Hello World");
	// ]]>
	</script>

causes run-time (syntax errors) in IE.

	<script type="text/javascript"><!-- <![CDATA[
		alert("Hello World");
	// ]]> -->
	</script>

seems to work (although my version of Gecko -- through Neoplanet's neat wrapper,
Neozilla -- doesn't seem to want to execute scripts no matter what).

The moral apparently is: avoid embedded *anything*!  :)

/Jelks

Received on Sunday, 26 September 1999 22:58:20 UTC