W3C home > Mailing lists > Public > whatwg@whatwg.org > October 2009

[whatwg] <object> behavior

From: Simon Pieters <simonp@opera.com>
Date: Fri, 16 Oct 2009 12:19:04 +0200
Message-ID: <op.u1v1l2k9idj3kv@simon-pieterss-macbook.local>
On Fri, 16 Oct 2009 12:10:35 +0200, Michael A. Puls II  
<shadow2531 at gmail.com> wrote:

> On Fri, 16 Oct 2009 05:28:46 -0400, Ian Hickson <ian at hixie.ch> wrote:
>
>> There was also some discussion of what to do about preventing a plugin
>> instantiating. It seems to me that authors can do that by not creating  
>> the
>> <object> element ahead of time.
>
> And, if it's desired to specify the <object> via parsed markup (as  
> opposed to doing it all with JS), one can omit @type and @data so things  
> don't load and add them later like so:
>
> <object style="display: none"  
> data-load-on-demand-type="application/x-java-applet" id="test">
>      <param name="code" value="MyJavaClass">
>      fallback
> </object>
>
> <script>
>      window.onload = function() {
>          var obj = document.getElementById("test");
>          obj.style.display = "inline-block";
>          obj.type = obj.dataset["load-on-demand-type"];
>          alert("Come alive! Hide your fallback! I command you!");
>      };
> </script>

"One or both of the data and type attributes must be present." says the  
spec.

<embed> doesn't seem to have the same requirement for src and type. (Also  
compare with img, iframe, video...)

-- 
Simon Pieters
Opera Software
Received on Friday, 16 October 2009 03:19:04 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:18 UTC