Greetings to all of you guys!

I'd like to share some thoughts about cloning events.

Here's some background quoted from

"One problem of the current implementation of W3C's event registration
model is that you can't find out if any
event handlers are already registered to an element. In the
traditional model you could do:


and you see the function that's registered to it, or undefined if
nothing is registered. Only in its very recent DOM Level 3 Events W3C
adds an eventListenerList to store a list of event handlers that are
currently registered on an element. This functionality is not yet
supported by any browser, it's too new. However, the problem has been

Fortunately removeEventListener() doesn't give any errors if the event
listener you want to remove has not been
added to the element, so when in doubt you can always use

the miss for a browser native "eventListenerList" is not a real issue
for removing events except that all responsibility to remember and
destroy registered handlers is on the application layer.

unregistering handlers could become trivial in the future (if) and
when #7435 will be merged into trunk.

but what about cloning events?

W3C specs are clear about this:

"When a Node is copied using the cloneNode method the EventListeners
attached to
the source Node are not attached to the copied Node. If the user
wishes the same
EventListeners to be added to the newly created copy the user must add

this could be a fair problem when operating on predictable node
or maybe an application layer nightmare if you have to deal with
unknown tree structures.

Now worst:

* Moz guys here decided to follow standards in y2k:

* Opera 9 behaves the same as Moz

* .... who knows what other browsers do!

* M$ guys decided that IE7 still behaves in it's way:
the test that follows show that events are copied along with nodes.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://">
<html xmlns="";>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
<script type="text/javascript" src="js/prototype/prototype.js"></

function sayHello() {

function testEventsClone() {
        var el = new Element('div').update('<a href="#">click me</a>');

        var el2 = el.cloneNode(true);

<title>CloneNode Test</title>



can someone argue how do deal with the whole mess?


You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at

Reply via email to