Re: Tidy gets over-zealous

Hello Chris,

Tidy is right about this warning, please check the HTML Reference's 
Appendix, 
[http://www.w3.org/TR/html4/appendix/notes.html#notes-specifying-data].

You'll have to mask your '</' with a backslash ('<\/'), in order to produce 
valid HTML, just as you'll have to mask '&' with '&amp;' when you are 
writing URLs.


Examples straight from that page:

                 <SCRIPT type="text/javascript">
                   document.write ("<EM>This won't work</EM>")
                 </SCRIPT>

                <SCRIPT type="text/javascript">
                  document.write ("<EM>This will work<\/EM>")
                </SCRIPT>


Some more information you may find on 
[http://www.htmlhelp.org/reference/html40/special/script.html]:

         Technically, the first occurrence of "</"
         followed by any letter is considered the end tag
         for the SCRIPT element. While browsers are
         forgiving in this, authors should avoid using
         strings such as "</P>" in their embedded scripts.
         JavaScript allows authors to use a backslash to
         avoid ending the SCRIPT element prematurely,
         e.g., document.write("<\/P>").


Enjoy...

sebastian

At 23:17 09.07.2000 -0400, Chris Knight wrote:
>Greetings!
>
>Tidy gives me: "Warning: '<' + '/' + letter not allowed here"
>when it finds JavaScript which writes HTML code containing '</'.
>
>I think Tidy should just skip over whatever is between <SCRIPT> and
></SCRIPT>.
>
>My 2 cents.
>
>
>Christopher Knight, Technical Communicator
>E-mail: cknight@attcanada.ca
>Phone: (604) 877-0074

--
Sebastian Lange
http://www.sl-chat.de/
Maybe the first chat site that validates as HTML
4.0 even though user input may contain HTML codes.

Courtesy to Dave Raggett's HTML Tidy:
http://www.w3.org/People/Raggett/tidy/

Received on Monday, 10 July 2000 04:26:23 UTC