[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: 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

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

text/html
<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
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]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.