[thelist] Javascript/HTML Validation
Andrew Clover
and-evolt at doxdesk.com
Wed Mar 10 09:51:36 CST 2004
Kevin Switzer <Kevin.Switzer at Stamats.com> wrote:
> The way you said didn't quite work, because it saw the </sty and thought
> there was an open tag for <sty> , so I changed the closing tag to
> <'+'/'+'style> and it worked great!
That's correct. The troublesome sequence is "</" ('ETAGO'). This is used
in SGML-based HTML to end an element that contains CDATA, such as
<script> and <style>. In common practice, browsers ignore ETAGOs that
aren't part of the close-tag for the current element, but validators are
more strict.
The canonical JS hack is to use a backslash string-literal escape:
document.write('<\/script>');
Of course things are different in XML, and all the more confusing if
you're writing XHTML as you have to obey the rules of both...
--
Andrew Clover
mailto:and at doxdesk.com
http://www.doxdesk.com/
More information about the thelist
mailing list