Why no <IMG> inside <PRE>?

Gerald Oskoboiny (gerald@cs.ualberta.ca)
Tue, 9 Jan 1996 23:26:44 -0700 (MST)


Subject: Why no <IMG> inside <PRE>?
From: Gerald Oskoboiny <gerald@cs.ualberta.ca>
To: www-html@w3.org
Date: 	Tue, 9 Jan 1996 23:26:44 -0700 (MST)
Message-Id: <96Jan9.232901-0700_mst.138878-3+92@amisk.cs.ualberta.ca>

My HTML validator, <URL:http://ugweb.cs.ualberta.ca/~gerald/validate.cgi>,
uses <IMG>'s inside <PRE>-formatted text to show where errors occur within
the HTML source text. To see a sample validation run with errors, look at
<URL:http://ugweb.cs.ualberta.ca/~gerald/validate.cgi?url=http://www.w3.org/
pub/WWW/MarkUp/>. :-)

Much to my chagrin, it turns out that it's invalid to use <IMG> inside
<PRE> in HTML 2.0. Is there some reason for this? (I guess I'm not asking
if there's some reason it's like this in HTML 2.0, but rather is there
some reason it "should" be this way in HTML?)

I managed to come up with a non-PRE-formatted version of my validator, at
<URL:http://ugweb.cs.ualberta.ca/~gerald/validate/>, but I prefer the old,
invalid version.

Would it be possible to get this changed for the next version of HTML
(whatever that turns out to be)? I've never heard of a browser that doesn't
support this (does anyone know of one?), and I think using <PRE> to align
things is now and will continue to be "current practice" until table support
is more widespread. (see, for example, <URL:http://sunsite.unc.edu/>.)

Uh, wait a minute... I just poked around the HTML 2.0 DTD a little bit,
and realized that:

   <PRE> ... <A NAME="foo"> <IMG SRC="bar"> </A> ... </PRE>

is valid, while

   <PRE> ...                <IMG SRC="bar">      ... </PRE>

is not. Argh. I wish I would've figured that out about a month ago before
wasting all that time redesigning the output of my validator.

I still think <IMG> should be made to be valid inside <PRE>, since it seems
silly to have to put <A NAME="..."> around each <IMG> as a hack around the
content models or whatever.

Gerald
-- 
Gerald Oskoboiny  <gerald@cs.ualberta.ca>  http://ugweb.cs.ualberta.ca/~gerald/