Re: [Bug 10901] New: Use same parsing for HTML <script> and SVG <script>

On Thu, 30 Sep 2010, ddailey wrote:
> 
> Any idea of what those rare edge cases might be?

The main one (assuming we do the CDATA thing) would be use of entities, so 
e.g.:

   <script>
     if (x &lt; 3)
       foo();
   </script>

...would no longer compile.

Also, document.write() would become re-entrant in SVG <script> if we made 
this change. Should people then try to use the same scripts in non-browser 
SVG clients, this will introduce a world of pain for those implementors 
the likes of which they have never experienced, if the equivalent pain 
felt by browser vendors over the years is any indication.

There's also other edge cases when it comes to non-conforming content 
(e.g. nested <script> elements would get treated radically differently, 
and the parsing of scripts containing strings containing "</script>" or 
"<!--" would become highly unintuitive). These don't affect valid 
documents though.

On a side note, one effect of the proposal that might affect HTML user 
agents is that <script>s in HTML containing CDATA-like blocks would begin 
to parse differently. How compatible this is with the Web, I don't know.

-- 
Ian Hickson               U+HTML5                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Thursday, 30 September 2010 23:27:18 UTC