Re: Javascript and Tidy

Peter Curran <[email protected]>
Newsgroups gmane.comp.web.html-tidy.user
Message-ID <[email protected]>
Thanks for responding.

Richard A. O'Keefe
<[email protected] > wrote:

Peter Curran
<[email protected] > 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 actually had checked some of the DTDs. I was kinda hoping I had
missed something.

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.

OK. So in my example, I would have
to add Javascript code to generate the "ul" and "/ul"
tags to be standard-compliant.

This is silly.

Peter Curran
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.