Mark Lundquist wrote:

Actually no, that's not what it does! :-)

The contents of a CDATA section are declared to have no XML metacharacters. So for instance, you can just write '<' instead of '&lt;' inside a CDATA section, or '&' instead of '&amp;'.

That's it. It has nothing to do with hiding anything from older browsers. It's just XML syntactic sugar for not having to escape certain character entities. (At any rate, note that if you're serving XHTML, then you don't care about older, pre-CSS browsers, right?)

_However— ... I can't think offhand of any CSS syntax that would normally include XML metacharacters that require escaping. There's the child selector '>', but that doesn't have to be escaped. So you're right, it probably _isn't_ necessary to escape <style> contents in XHTML.

Javascript in a <script> element is another story, though. There you'll routinely find '&' and '<', and those do need to be escaped. But again, it has nothing to do with hiding the Javascript from incapable browsers — if you care about that, then you still need to enclose it in comments, even if you have <[cdata[...]]> around it.


Mark:

Thanks for clarifying. I guess I was misinformed about that, I'm pretty sure I read that online somewhere, so I guess that goes to show you should be careful about what you read on the web.

Thanks,
Matthew
______________________________________________________________________
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to