Re: Javascript and Tidy

Peter Curran <pcurran@sympatico.ca> wrote:
	Tidy objects to a missing "li" tag. Of course, that is in the 
	generated code that Tidy cannot "see."
	
	I understand that Tidy cannot interpret the Javascript and verify 
	that it generates the required "li" tag. However, the implication of 
	the message is that only an "li" tag is permitted in this position - 
	I would think that a "script" tag should be valid, even if Tidy 
	cannot interpret the results of executing the script.
	...
	My question is, is a "script" tag really invalid here, or is Tidy 
	just making the worst-case assumption, that the script may not 
	generate valid HTML code?

It's easy enough to find out.  Just hop over to the www.w3.org web site
and check the DTD.  If we're talking about HTML 4 here, the rule in the
DTD is quite simple and quite explicit:

<!ELEMENT UL - - (LI)+                 -- unordered list -->

This says, "A <UL> element may contain one or more <LI> elements,
nothing else."  Since this is an "element content" model, white space
and comments are also allowed.  But certainly no other elements whatever
are allowed, and <SCRIPT> is no exception.

	I would think that scripting was designed 
	for exactly these kinds of applications, and I can't imaging why it 
	would be disallowed.

Scripting may have been designed for these applications,
but HTML was never really designed for scripting.
The fact is that it IS disallowed.

	but I would like to know if what I am doing is really an error.
	
Yes it is.

Received on Friday, 26 May 2006 06:10:47 UTC