Well, first question is what exactly are you trying to accomplish?
For the general case, you can accomplish a right click event handler with jQuery very easily... Rule of thumb is to bind only one event handler for the entire tree (for performance reasons), and filter out with selectors which nodes should invoke the right click handler. Don't think about it in terms of attaching an event to each node, but rather an event to the entire and filter out which nodes invoke the right click event handler in the tree.
Take a look at the code in the link below... I only attach an event handler to the entire tree, then filter out the kinds of nodes that I get the right click event for.