[whatwg] <object> behavior

Andrew Oakley andrew at ado.is-a-geek.net
Thu Aug 6 05:42:25 PDT 2009


The rules in the HTML5 spec for which plugin to load for an <object> do
not seem to be followed by any browser, and in some cases are different
to behavior that is common to Opera, Webkit and Gecko (I haven't tested
with IE due to its lack of nsplugin support).

Most notably HTML5 says that the Content-Type header is used in
preference to the type attribute, whereas the browsers seem to honour
the attribute in preference to the header.  (If the spec is changed to
match the browsers behaviour then the conditions on when to load a new
plugin also need to be changed.)  HTML5 also seems to prefer the type
attribute on <script>s rather than the Content-Type header.

Detaching and reattaching a <object> from the document seems to make the
browsers destroy the object and then recreate it.  Presumably this means
that the DOM objects also change depending on whether or not an <object>
is attached to the document (haven't confirmed that this is the case).

Changing the attributes on an <object> that is attached to the document
doesn't seem to "work" - Webkit does nothing, Opera seems to stop
scripting (presumably some kind of error), Firefox reloads the plugin in
some cases (even if its not the right one anymore).

Removing an <object> from the document (browsers destroy plugin object),
changing the attributes and reattaching it to the document (browser
creates plugin object) seems to work fairly reliably across browsers.

In effect it seems that browsers use the attributes that were on the
<object> when it was attached to the document, and do not respond to
changes in the attributes.

The test cases I used are available at
http://ado.is-a-geek.net/~andrew/pluginstest.tar.bz2 (sorry they are
somewhat linux based due to the platform specific plugins).

In summary I have a few questions related to <object>s:
- Should the type attribute take precedence over the Content-Type header?
- Should <object>s exist all the time whether they are attached to the
document or not?
- Should changing the attributes change the plugin, or should we just
use the attributes when the object was attached to the document?

Cheers

-- 
Andrew Oakley



More information about the whatwg mailing list