Re: Bug: putting elements into body

On Sat, 2 Sep 2000, Bjoern Hoehrmann wrote:

> Hi,
> 
> Tidy should wrap the following into a BODY element, but it does not:
> 
> % tidy
> 
> Tidy (vers 4th August 2000) Parsing console input (stdin)
> <object width=288 height=122 data="1.xml" type="text/xml"><img
> src="file://q:/css/source/intro/images/xml-example.gif"/></object>
> line 1 column 59 - Warning: img lacks "alt" attribute
> 
> ^Z
> line 4 column 1 - Warning: inserting missing 'title' element
> 
> stdin: Document content looks like HTML 4.01
> 2 warnings/errors were found!
> 
> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
> <html>
> <head>
> <meta name="generator" content="HTML Tidy, see www.w3.org"><object
> width="288" height="122" data="1.xml" type="text/xml"><img src=
> "file://q:/css/source/intro/images/xml-example.gif"></object>
> <title></title>
> </head>
> </html>

The HTML4 spec allows object to be placed within the head:

 The OBJECT element may also appear in the content of the HEAD
 element. Since user agents generally do not render elements in the
 HEAD, authors should ensure that any OBJECT elements in the HEAD
 do not specify content that may be rendered. Please consult the
 section on sharing frame data for an example of including the
 OBJECT element in the HEAD element.

I guess that one rule of thumb would be to check for content
within the object element other than param. This is getting fairly
hairy though, and I can't see an easy way to implement what you
are asking for. One solution would be to insert a check at the
start of ParseBody. This would search through the head for object
elements and move them when appropriate to the start of the body.
I have implemented this as BumpObject() in clean.c.

Regards,

-- Dave Raggett <dsr@w3.org> http://www.w3.org/People/Raggett
tel/fax: +44 122 578 3011 (or 2521) +44 778 532 0444 (mobile)
World Wide Web Consortium (on assignment from HP Labs)

Received on Saturday, 16 September 2000 10:45:55 UTC