W3C home > Mailing lists > Public > html-tidy@w3.org > July to September 2002

RE: bug report: possible erroneous warnings from tidy in script content

From: Jelks Cabaniss <jelks@jelks.nu>
Date: Thu, 11 Jul 2002 12:00:34 -0400
To: <html-tidy@w3.org>
Message-ID: <001101c228f4$17eaa4a0$6601a8c0@blackie>

Charles Reitzel wrote:

> > document.write("<A href='"..."'>", linktext, "</A>");
> > line 22 column 72 - Warning: '<' + '/' + letter not allowed here

> It wants to be "<\A>", not "</A>".  

I think what Charlie meant to say is "It wants to be "<\/A>".

This issue is probably FAQ question #1 for all Tidy users and [x]HTML
validator users.  The problem is that something that "works" in a
forgiving browser is more often than not valid from a *markup* point of

Bottom line: when coding end tags in Javascript in document.write()'s
and the like, escape them so the XML (for XHTML) or SGML (for HTML)
parser doesn't see it as a "real" (and out-of-place) end tag.  You can
do it in several ways:

	document.write("whatever<" + "/a>")

Etc.  The first one uses a backslash to mean "escape the next
character", i.e. "write it literally".  So the *Javascript* parser will
essentially treat the '\/' the same as a plain '/', and thus "<\/a>" the
same as "</a>", But the *ML parser will see it as a character string of
"<\/a>" and not as an end tag. 

Check out ...


Received on Thursday, 11 July 2002 12:00:49 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:38:52 UTC