views:

62

answers:

4

Do you know a JS library for dom events simulation? I know that this operation can be done but i can't find any library to do it.

UPDATE: I try to explain better my question. Javascript can simulate events like the user click, i'm looking for a library that helps me with this operation.

+2  A: 

http://developer.yahoo.com/yui/3/event/#eventsimulation

""" Simulated events are browser-created events that, most of the time, behave exactly as user-initated events. Events bubble as they normally would and event objects are created with properties containing data about the event (sometimes these properties are browser-specific, so it's recommended that you make use of the browser-equalizing methods of Y.Event to retrieve the appropriate values for properties such as target, relatedTarget, and charCode. All event handlers are called synchronously at each event target throughout the event's lifetime. Events are simulated using the simulate() method on any Y.Node instance. """

Marco Mariani
+1  A: 

You can use prototype.js to fire your own custom events

e.g. treeContainer.fire('nodeIcon:mousedown', {targetEvent: event, node: node});

plodder
+2  A: 

All of the major javascript libraries have the ability to trigger events. To add to the chorus of examples, in jquery you do it with: $("target_element").trigger("an_event");

Sean Vieira
+3  A: 

Kangax made a very useful set of extensions for the PrototypeJS framework, the one that might interest you is Event.simulate

Fabien Ménager
Perfect that's exactly what i was looking for. Thanks.
mck89