W3C home > Mailing lists > Public > whatwg@whatwg.org > November 2006

[whatwg] Handling of script elements inside rendered OBJECT

From: Ian Hickson <ian@hixie.ch>
Date: Wed, 8 Nov 2006 00:48:47 +0000 (UTC)
Message-ID: <Pine.LNX.4.62.0611080045001.30375@dhalsim.dreamhost.com>
On Wed, 10 May 2006, Shadow2531 wrote:
>
> <object type="text/html" data="about:blank">
>     <script>alert('You should not see this!');</script>
> </object>
> 
> What should happen in situations like that?
> 
> The script element is alternate content.
> The object is rendered.
> The script SHOULD NOT be executed *until* the alernate content is
> rendered. (For example, if it's an image, you switch images off and
> the alternate content is rendered.)
> 
> It makes sense to NOT execute the script in this situation.
> 
> However, browsers currently execute the script. (IE6 does not, but
> that may be quirky object tag handling.)

The <script> would be executed straight away. <script> elements are 
executed as soon as they enter the Document DOM, irrespective of where 
they are inserted.

(The spec is clear about this now, though some areas still need fleshing 
out.)

We basically have to do this because script execution and <object> 
handling are really complicated already, and trying to link them would 
only make them even more complicated and lead to hard-to-debug bugs.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Tuesday, 7 November 2006 16:48:47 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:58:49 UTC