W3C home > Mailing lists > Public > html-tidy@w3.org > April to June 2006

Re: Javascript and Tidy

From: Richard A. O'Keefe <ok@cs.otago.ac.nz>
Date: Fri, 26 May 2006 18:10:30 +1200 (NZST)
Message-Id: <200605260610.k4Q6AUXk086813@atlas.otago.ac.nz>
To: html-tidy@w3.org

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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 3 April 2012 06:13:56 GMT