Re: cloneNode() and script execution

On Sun, 18 Jan 2009, Hallvord R. M. Steen wrote:
> 
> Here is another issue for Ian to ponder while working on the script 
> execution stuff:
> 
> If you clone a script node and append the to the document, does it run?

Per spec, no. The spec says the "already executed" flag is copied when 
the element is cloned. (It has said this for some time.)


> Browsers differ:
> 
> cloneNode(true) - Opera no, Firefox no, Safari yes, IE fails
> cloneNode(false) - Opera yes, Firefox no, Safari yes, IE fails
> 
> From my naturally biased point of view I think Opera makes more sense - 
> a "deep" clone remembers that the script was already executed, a shallow 
> doesn't because it doesn't clone the script code. I think any use cases 
> one might think of for re-executing script clones are already much 
> better handled by putting the code inside a function and doing a simple 
> function call.

I really don't think we want to make this depend on the flag. This is an 
edge case, the least complexity here the better.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Thursday, 12 February 2009 06:29:27 UTC