W3C home > Mailing lists > Public > public-html@w3.org > August 2007

Re: Distributed Extensibility

From: Philip Taylor <philip@zaynar.demon.co.uk>
Date: Thu, 02 Aug 2007 20:24:49 +0100
Message-ID: <46B22F81.8020708@zaynar.demon.co.uk>
To: public-html@w3.org

Sam Ruby wrote:
> The default processing by existing user agents is to 
> render text nodes even when they are enclosed in unknown markup.  In 
> some cases, this may not be desirable.  The XML CDATA[] syntax is 
> treated as a comment by HTML parsers, so this may be used to “cloak” 
> such text regions.

<![CDATA[...]]> in HTML doesn't appear to be handled usefully by any of 
IE/FF/Opera/Safari, and not interoperably by most, and not sanely by some.

After writing "<![CDATA[":
   IE7, Safari 3: Closes after the first '>'.
   Firefox 3: Closes after the first '>' which is after a ']'.
   Opera 9.2: Counts the nesting depth of square brackets (starting at 2 
in this case), incrementing on each '[' and decrementing on each ']' 
(allowing a negative nesting depth), and when it sees the first '>' at 
nesting depth 0 then it deletes the prior two characters and adds a 
CDATA node to the DOM. (It does the same for anything else that starts 
with "<!" and doesn't start with "<!--", except it doesn't create the 
CDATA node.)


It would work alright across the browsers if you never put any '[', ']' 
or '>' inside the CDATA section, but that seems too limited to be of any 

Philip Taylor
Received on Thursday, 2 August 2007 19:24:51 UTC

This archive was generated by hypermail 2.3.1 : Thursday, 29 October 2015 10:15:25 UTC