cloneNode() and script execution

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?

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.

-- 
Hallvord R. M. Steen
Core JavaScript tester, Opera Software
http://www.opera.com/
Opera - simply the best Internet experience

Received on Sunday, 18 January 2009 01:17:12 UTC