[whatwg] <object> behavior

Michael A. Puls II shadow2531 at gmail.com
Wed Sep 2 23:15:28 PDT 2009

On Wed, 02 Sep 2009 17:39:00 -0400, Ian Hickson <ian at hixie.ch> wrote:

> On Thu, 27 Aug 2009, Michael A. Puls II wrote:
>> Here's an example that uses a more modern plug-in that shows what
>> browsers do.
>> window.onload = function() {
>>     var obj = document.createElement("object");
>>     obj.type = "application/x-shockwave-flash";
>>     obj.data = "http://adobe.com/shockwave/welcome/flash.swf";
>>     obj.width = "320";
>>     obj.height = "240";
>>     //document.body.appendChild(obj);
>>     //obj.style.display = "none";
>>     setTimeout(function() {
>>         alert(obj.SetVariable);
>>     }, 1000);
>> };
>> In other words, for a plug-in to be initialized (and scriptable if it's
>> capable):
>> 1. Its element must be attached to the document.
> I'm told this is considered a bug.

O.K., so once that's fixed in browsers, if I do:

var obj = document.createElement("object");
obj.type = "application/x-shockwave-flash";
obj.data = "file.swf"
obj.appendParam("quality", "low");

, will that load as soon as I set @type (according to HTML5) and result in  
@data and the param not being honored because the plug-in already  

If so, then, I'd have to add set @type to "application/x-shockwave-flash"  
again (or to a different value and back if that doesn't work) to destroy  
the instance and create another one that actually honors the stuff I added  
after setting @type. If so, then I could instead save @type or @data for  
last (which would be unexpected to have to do), but if I needed to set  
them both, I'd have an unnecessary destroy and create.

Or, will it wait till the full script in the scope is evaluated to load  
any plug-in instances?

What happens if an autostart (for example) param is set and the movie  
autoplays? Will there at least be audio until it's appended to the  
document and shown, or will file operations be delayed till it's actually  
appended to the document? If the plug-in methods are callable before the  
object is appended to the document, but file operations are delayed till  
the object is appended to the document, what would happen if you called  
the plug-in's playFile() method for example? Would it throw an error then?

What if a plug-in always autoplays as soon as it's initialized, but you  
don't want things to start playing until the object is appended to the  
document and shown? Do you now have to append an empty <object> to the  
document first and then set @type etc. instead of building the whole  
object first and then appending?

Does this also apply to innerHTML on an element that's not appended to the  
div.innerHTML = "<object> markup";

That'd be initialized right away too?

Things work a certain way now. If fixing "the bug" changes that, I want to  
be sure exactly how.



More information about the whatwg mailing list