Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: Why doesn't cloned nodes in Gecko (e.g. Netscape 6+, Mozilla, Phoenix etc) keep their events...?


Message #1 by "Robert Nyman" <robert.nyman@c...> on Thu, 6 Mar 2003 11:53:22 +0100
Thanks.
Unfortunately, just moving the nodes aren't an option for me.

I still think that being able to keep the event listeners when cloning
should be an option...
In my case (in a tree control), it will be hell to add it manually when
whole structures are
cloned and appended somewhere else...


/Robert


-----Original Message-----
From: Joe Fawcett [mailto:joefawcett@h...]
Sent: den 6 mars 2003 12:41
To: javascript
Subject: [javascript] Re: Why doesn't cloned nodes in Gecko (e.g.
Netscape 6+, Mozilla, Phoenix etc) keep their events...?


Just found this as well about moving nodes etc.:
http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030221/events.html#Eve
nts-EventListener

Joe






>From: "Robert Nyman" <robert.nyman@c...>
>Reply-To: "javascript" <javascript@p...>
>To: "javascript" <javascript@p...>
>Subject: [javascript] Why doesn't cloned nodes in Gecko (e.g. Netscape
>6+,
>Mozilla, Phoenix etc) keep their events...?
>Date: Thu, 6 Mar 2003 11:53:22 +0100
>
>Ok, here's the problem...
>
>I create nodes dynamically with document.createElement etc
>and then attach their events with the addEventListener method. So far,
>it's working just fine.
>
>But when I clone that node (with the cloneNode method, as in
>elm.cloneNode(true)), and append it somewhere else in the document, it
>has lost its events. And it doesn't matter if I delete the original
>node or not, the events won't work either way...
>
>One method that seems to work is if I use oElm.setAttribute("onClick",
>"functionName()"); instead, but this approach is not an interesting
>option for me...
>
>Does anyone know why it's like this?
>Does any specs say that the events shouldn't be cloned?
>
>
>/Robert
>
>---
>Change your mail options at http://p2p.wrox.com/manager.asp or to
>unsubscribe send a blank email to 


_________________________________________________________________
Stay in touch with absent friends - get MSN Messenger
http://messenger.msn.co.uk



  Return to Index