[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
Re: [xml-dev] Benefits of polyglot XHTML5
- From: David Carlisle <davidc@nag.co.uk>
- To: Jesper Tverskov <jesper.tverskov@gmail.com>
- Date: Mon, 05 Sep 2011 01:53:48 +0100
On 03/09/2011 10:17, Jesper Tverskov wrote:
> In order to come to terms with HTML5 and finding out, what happened
> to XHTML, I have made a tutorial:
>
> "Benefits of polyglot XHTML5",
> http://www.xmlplease.com/xhtml/xhtml5polyglot/
>
> Nice to know if I have forgotten something or if things need to be
> corrected.
>
the snippet:
>
> Since "<" and "&" are common in JavaScripts and must be escaped in
> XML, JavaScripts are often impossible to use inside XML webpages.
>
could be read as saying you can't use inline javascripts in xhtml,
whereas the only restriction is that you can't have them in polyglot as
the escaping rules are different.
text/html
<script> a < B </script>
just needs to be written
<script> a < B </script>
in xml mime types, so inline javascript is certainly possible in xml
webpages.
similarly
> ... You still have one option left if you want to make well-formed
> documents and use internal JavaScripts. You can use mimetype
> "text/html" and hide the JavaScripts inside comments (not allowed in
> polyglot markup). Also in XML you can't use JavaScript's
> "document.write()". Instead use the "innerHTML" property.
appears to refer to the old idiom of putting the script inside an html
comment
<script><!--
a < b
--></script>
which hides the script from ancient browsers that don't recognise
script, however more useful in a ployglot context is to not place the
entire script in a comment but just to place a CDATA section start tag
in a (javascript) comment and not place the script inside a comment.
<script>
\\<![CDATA[
a < b
\\]]
</script>
works identically in html and xhtml, and is just banned in ployglot as
the parse tree is not identical, even though the only difference is two
javascript comments ignored by the javascript processor.
David
[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]