W3C home > Mailing lists > Public > www-svg@w3.org > March 2009

Re: CDATA, Script, and Style

From: Henri Sivonen <hsivonen@iki.fi>
Date: Thu, 19 Mar 2009 09:13:07 +0200
Cc: Doug Schepers <schepers@w3.org>, HTML WG <public-html@w3.org>, www-svg@w3.org
Message-Id: <BB3CEB01-7E9C-409F-BFA4-0F2DE461120A@iki.fi>
To: Jonas Sicking <jonas@sicking.cc>
On Mar 19, 2009, at 00:56, Jonas Sicking wrote:

> However, if the style was
>
> <style type="text/css">
>  svg &gt; rect {
>    fill: red;
>  }
> </style>
>
> then this would work as expected in XML-SVG, but there might possibly
> be problems when the markup is copied into a text/html document. In
> HTML, the contents of <style> is parsed as CDATA. That means that no
> entities are escaped. So the above style tag would contain invalid CSS
> as the "&gt;" would not be turned into a ">" and so the selector would
> be invalid and not match anything.
>
> So the question is, how common do we think this is? We're looking for
> how common it is that:
> 1) An SVG file contains inline <style>, *and*
> 2) That style does not use <![CDATA[]]> for the contents of the  
> element, *and*
> 3) The contents uses entities.


I don't know how common it is, but this situation arises easily with  
an XML serializer that never outputs CDATA sections either because it  
is connected to SAX ContentHandler but not LexicalHandler or just  
because writing a serializer that doesn't output CDATA sections is  
some much easier to do correctly.

-- 
Henri Sivonen
hsivonen@iki.fi
http://hsivonen.iki.fi/
Received on Thursday, 19 March 2009 07:13:52 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:41 GMT