Re: Webpage breaks as closing span tag doesn't close object

On Wed, 18 Nov 2009 18:37:15 +0100, Geoffrey Sneddon <gsneddon@opera.com>  
wrote:

> <http://www.redhat.com/docs/en-US/JBoss_Enterprise_Application_Platform/4.2.0.cp06/html-single/Transactions_Failure_Recovery_Guide/>  
> breaks with an HTML 5 parser, but works in Firefox (sans HTML 5 parser)  
> and WebKit. Firefox appears to close the object upon encountering the  
> closing span tag. Probably ought to do more work at working out what is  
> required for object.

The relevant markup is basically <h3><span><object  
data="svg"></span></h3>. IE doesn't close the object, but when the  
resource has been loaded it finds out that it doesn't support SVG and  
replaces the object element with its ...contents. So, before it has loaded:

H3
|
+-- SPAN
.   |
.   +-- OBJECT

After it has loaded:

H3
|
+-- SPAN
.   |
.   +-- /SPAN
.   |
.   +-- /H3
.   | (rest of page)

At least that's what happens in IE7 in my testing in the live dom viewer;  
when loading that page, IE7 doesn't fall back so the page content is eaten  
like in Opera and with HTML5. (Even if it did fall back, it would all be  
in h3 so would probably have the wrong style.)


I'm pretty sure there are pages that rely on the IE/Opera/HTML5 behavior  
of scoping <object>, so making it not scoping will break other pages.


In Firefox with the old parser, <object> is not scoping, but <applet> is;  
<p><applet></p>x doesn't close the applet. However, <span><applet></span>x  
does close the applet, so span is magic.

In WebKit, <object> is scoping; <p><object></p>x doesn't close the object.  
However, <h3><object></h3>x does close the object, so h1-h6 are magic. I  
note that div is also magic.

-- 
Simon Pieters
Opera Software

Received on Wednesday, 18 November 2009 19:24:37 UTC