Re: Validator allows designers to do invalid nesting through <ins>

On Tue, 10 Aug 2004, Frank Ellermann wrote:

> But I still like the similar trick...
>
> <span><img src="2003.jpg" alt="2003" /></span>
>
> ...where <span> allows me to use icons within <pre>.

But <img> within <pre> "works" just as well without the <span>. If
validation makes you add artificial, illogical markup just to suppress
validation warnings, I don't think you are _making use_ of validation.
Validators should be used (only) to detect and report syntax errors that
you might otherwise miss to notice; but here you would use <span> just to
prevent it from reporting an error - valid or not, putting <img> inside
<pre> (directly or indirectly) violates HTML specifications.

Actually if you upgraded from XHTML to HTML 4.01 :-), a validator would
still report an error if you used the extra <span> markup. The reason is
that HTML 4.01 syntax has been defined using a more powerful metalanguage
(SGML instead of XML) - in particular, it has "exclusion exceptions" which
allow the DTD author specify that an element must not indirectly contain
certain elements even though they would otherwise be permitted.

> Sometimes the nesting rules are a pain, e.g. you need
> <frameset><!-- ugly frames --><noframes><body><h1> for
> a <h1> within <noframes>.

It's not a matter of nesting. In HTML 4.01, where you may omit the <body>
_tag_ there, there is still a <body> _element_ as the sole content of the
<noframes> element (and the implicit <body> element then contains the <h1>
element). XHTML plays by different rules: it has less inflexible syntax,
with obligatory verbosity, so that _all_ elements that are present must
have a start tag and an end tag.

-- 
Jukka "Yucca" Korpela, http://www.cs.tut.fi/~jkorpela/

Received on Tuesday, 10 August 2004 21:01:02 UTC