[whatwg] Handling of script elements inside rendered OBJECT

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