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

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
view.

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>")
	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 ...

	http://www.htmlhelp.com/tools/validator/problems.html


/Jelks

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