OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] Benefits of polyglot XHTML5

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.

<script> a < B </script>

just needs to be written

<script> a &lt; B </script>

in xml mime types, so inline javascript is certainly possible in xml


> ... 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

a < b
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.
a < b
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.


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS