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/
Message-Id: <m0tZvrg-0002UVC@beach.w3.org> To: Gerald Oskoboiny <gerald@cs.ualberta.ca> Cc: www-html@w3.org Subject: Re: Why no <IMG> inside <PRE>? Date: Wed, 10 Jan 1996 03:26:35 -0500 From: "Daniel W. Connolly" <connolly@beach.w3.org> In message <96Jan9.232901-0700_mst.138878-3+92@amisk.cs.ualberta.ca>, Gerald Os koboiny writes: >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?) No -- no good reason, anyway. I think this was on the "to-do" list during the HTML 2.0 review, and I just forgot to do it. I was surprised myself when I went back and realized this change never got made. >Would it be possible to get this changed for the next version of HTML Yes. In fact, if anybody feels like cooking up DTDs as candidates for new versions of HTML, please put them on the web and send a note including the address to this list. For example, see: http://ogopogo.nttc.edu/spec/html/modular-dtd.html Dan
From: Abigail <abigail@tungsten.gn.iaf.nl> Message-Id: <199601100835.JAA30480@tungsten.gn.iaf.nl> Subject: Re: Why no <IMG> inside <PRE>? To: www-html@w3.org Date: Wed, 10 Jan 1996 09:35:33 +0100 (MET) You, Daniel W. Connolly wrote: ++ ++ In message <96Jan9.232901-0700_mst.138878-3+92@amisk.cs.ualberta.ca>, Gerald Os ++ koboiny writes: ++ >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?) ++ ++ No -- no good reason, anyway. I think this was on the "to-do" list ++ during the HTML 2.0 review, and I just forgot to do it. I was surprised ++ myself when I went back and realized this change never got made. Hmm, I always thought it was because the unit in <PRE> is characters, and the unit of images is pixels. If I have: <pre> a b <img src = "foo.gif" alt = "xxx"> d 1 2 3 4 </pre> to which should the 4 (vertically) align? I fail to see how something can be "preformatted" (but using my font size) and yet include images whose size bears no relation which the choosen font size. ++ >Would it be possible to get this changed for the next version of HTML ++ ++ Yes. ++ ++ In fact, if anybody feels like cooking up DTDs as candidates for new ++ versions of HTML, please put them on the web and send a note including ++ the address to this list. Well, the 28 March 1995 HTML 3.0 specifically excludes <IMG> from <PRE>: <!ENTITY % pre.exclusion "TAB|MATH|IMG|BIG|SMALL|SUB|SUP"> <!ELEMENT PRE - - (%text)* -(%pre.exclusion)> It always made sense to me... (that is, the exclusion of <IMG> in <PRE>). Abigail
Message-Id: <m0tZxMb-000PrkC@lion.statslab.cam.ac.uk> From: Stephen Turner <S.R.E.Turner@statslab.cam.ac.uk> Subject: Re: Why no <IMG> inside <PRE>? To: www-html@w3.org Date: Wed, 10 Jan 1996 10:02:37 +0000 (GMT) A shorter kludge is <pre><tt><img></tt></pre>. I agree with Abigail that there are good reasons to disallow it, though I think images can be used fairly safely at the ends of <pre> lines. -- Stephen R. E. Turner Stochastic Networks Group, Statistical Laboratory, University of Cambridge e-mail: sret1@cam.ac.uk WWW: http://www.statslab.cam.ac.uk/~sret1/home.html
Subject: Re: Why no <IMG> inside <PRE>? From: Gerald Oskoboiny <gerald@cs.ualberta.ca> To: www-html@w3.org Date: Wed, 10 Jan 1996 10:06:13 -0700 (MST) Message-Id: <96Jan10.100830-0700_mst.138884-3+20@amisk.cs.ualberta.ca> Abigail writes: > Daniel W. Connolly wrote: > ++ > ++ Gerald Oskoboiny writes: > ++ >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?) > ++ > ++ No -- no good reason, anyway. I think this was on the "to-do" list > ++ during the HTML 2.0 review, and I just forgot to do it. I was surprised > ++ myself when I went back and realized this change never got made. > > Hmm, I always thought it was because the unit in <PRE> is characters, > and the unit of images is pixels. If I have: > > <pre> > a b <img src = "foo.gif" alt = "xxx"> d > 1 2 3 4 > </pre> > > to which should the 4 (vertically) align? I guess that would be "undefined", but, if you have: <pre> a b <img src = "foo.gif" alt = "xxx"> d 1 2 <img src = "bar.gif" alt = "yyy"> 4 </pre> and "foo.gif" is exactly as wide as "bar.gif", the behavior is well-defined, and extremely useful. (as in, for instance, <URL:http://sunsite.unc.edu/>.) Gerald p.s. anyone know why this is being echoed on www-talk? -- Gerald Oskoboiny <gerald@cs.ualberta.ca> http://ugweb.cs.ualberta.ca/~gerald/