xsl-list
[Top] [All Lists]

Re: Preventing tags from collapsing

2005-04-15 02:56:50
  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
________________________________________________________________________

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>