[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Preventing tags from collapsing


Subject: Re: [xsl] Preventing tags from collapsing
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 15 Apr 2005 10:56:50 +0100

  I inserted an html comment:

  <script ...><!--Leave this here to solve and IE bug--></script>


If you do that in an HTML file (rather than an XHTML File) you are
relying on bugs "or quirks compatibility mode or whatever you want to
call it"

<script> in HTML  is a normal element with PCDATA content so within such
an element <!--Leave this here to solve and IE bug--> is a comment, and
will be ignored.

However in HTML <script> is a CDATA element (an element type that does
not exist in XML) which means that < inside script is _not_ takken as a
start of markup unless it is followed by /script>  which means you can
write 
a , b in your javascript but also means 
<!--Leave this here to solve and IE bug-->
is _not_ a comment it is a string of text in the element content and in
a conforming system would be passed  as part of the element content to
the script interpretter which would then report a script error.
The fact that your browser doesn't do that and filters out this text as
it "looks like" a comment is just typical browser behaviour working on
hueristics rather than implementing languages as specified.

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________


Current Thread
Keywords