Javascript cloneNode with events

gmailgreasemonkeyjavascript

I am working on a greasemonkey script for gmail where i need to make a copy of the "Inbox" link. Using cloneNode works ok, but i think there's an onclick event that gets attached to it at runtime. So, this is a two part question:
1. Is there a way to see what events are attached to a node?
2. Is there a way to copy those events as well?
The closest thing i found was jQuery, and i am not ready to go there yet.
Thanks!

Best Solution

  1. Not unless it's set using the onclick attribute on the element.
  2. Not reliably (you can copy the onclick attribute, but whether that will continue to work depends on if it was used and what it does).

You're better off adding your own click handler, and then triggering that event on the original... Or simulating the behavior in some other way.