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

Re: HTML Tidy bug (general) + Mac Tidy (BBTidy) suggestion

From: <html-tidy@war-of-the-worlds.org>
Date: Sun, 30 Apr 2000 10:56:25 -0500
Message-Id: <p04310101b532029b1bb7@[216.229.13.10]>
To: html-tidy@w3.org
mech@eff.org (Stanton McCandlish) wrote:

>I've managed to generate similar errors with other text+markup in the form:
>
><SPAN CLASS="x"><P><SPAN CLASS="y">text</SPAN></P></SPAN>
>
>(That very example yields the same errors. Tidy doesn't realize that
>the first span is enclosing the <P>...</P>, and doesn't recognize that
>the second span has any attributes at all.)
>
>I suppose one can argue that <SPAN>...</SPAN> is only intended to be
>used within block elements and never surrounding them, though I don't
>see that specified in the HTML 4.0.1 spec anywhere

Then what is this:

<!ELEMENT SPAN - - (%inline;)*         -- generic language/style container -->

That says SPAN can only contain inline markup.  Paragraphs aren't inline
markup.  If you want to wrap a paragraph with another container, use
something that can wrap block or flow, like DIV:

<!ELEMENT DIV - - (%flow;)*            -- generic language/style container -->

> (and I'd have to
> argue against it if it is in there, since the element is widely used,
> and widely interpreted by agents, as having no such restriction,

The existence of tag-soup browsers is no excuse for elimination of all the
rules regarding the construction of an HTML document.  If you want to
produce invalid documents, Tidy is not the program or you.

> not to
> mention that <DIV>...</DIV> typically has undesirable spacing effects
> (linebreak before and after as if it were a <H#>...</H#>), leaving no
> real option but <SPAN>...</SPAN> for applying CLASS information w/o
> otherwise altering appearances, in many cases.

In case there's some confusion, let me provide an example:

<DIV CLASS="x"><P><SPAN CLASS="y">text</SPAN></P></DIV>

Replace the outer SPAN with DIV, not the inner SPAN (where you can't have
DIV).  The DIV here doesn't induce any spacing effects not already present
on the paragraph, so you don't have a reason for not using it in your
example.

If Tidy knew more about stylesheets (and had access to the stylesheets for
a page run through it) it could intelligently replace SPAN tags with DIV
and vice versa according to the user's intent rather that dropping them.
The problem arises when the stylesheet has defined SPAN.class or DIV.class
rather than generic classes, or styles applied to all SPAN and DIV tags.
-- 
         ,=<#)-=#  <http://www.war-of-the-worlds.org/>
    ,_--//--_,
 _-~_-(####)-_~-_  "Did you see that Parkins boy's body in the tunnels?" "Just
(#>_--'~--~`--_<#)  the photos.  Worst thing I've ever seen; kid had no face."
Received on Sunday, 30 April 2000 11:56:29 GMT

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