- From: Thomas Broyer <t.broyer@gmail.com>
- Date: Sun, 10 Dec 2006 00:47:09 +0100
2006/12/5, Michel Fortin: > > It's interesting you mention <script>. If we want some sort of XML > data island, we could use something like this: > > <script type="text/xml"> > <xml-content/> > </script> > > Then, after the content of <script> has been gathered, the browser > could parse it as actual XML, stopping at the first parse error. You > could even use JavaScript to gather the text from the DOM, parse the > XML and create the DOM tree accordingly since the text content of the > script is available in the DOM. The only requirement would be that > the XML content does not include any "</script>" itself (See note at > the end). > > I'm not sure if this is a plus or not, but it also seem that this > syntax is supported by Internet Explorer's data islands[1], although > I assume IE uses its own special parser mode for this. (But I'm just > guessing here.) This is supported by IE and it seems it also works in other browsers too, as it is something used by Microsoft's ASP.NET 2.0 AJAX library <http://ajax.asp.net> for their text/xml-script. The script is gathered from the <script> element using the DOM then parsed using an XML parser (don't ask me how it's done in a cross-browser way, I just know it works in both IE and Firefox, and I'm pretty sure it also does in Safari and Opera). However, text/xml-script would result in a parse-error in HTML5 (if I understand section 9.2 correctly). I'm not found of using <script> for inlining SVG or MathML, but it is proven to work on current browsers. We just have to make sure HTML5 won't declare those documents invalid, and for this we need to say that </ is not a parse error inside <script> and shouldn't be treated as an EndTag token except if it actually is the </script> end tag. -- Thomas Broyer
Received on Saturday, 9 December 2006 15:47:09 UTC