UIEvent.initUIEvent() (Method)

After creating a UIEvent object with document.createEvent(), it must be initialized with this method call.


DOM level - 2
JavaScript - 1.5
Netscape version - 6.0
JavaScript syntax:NmyUIEvent.initUIEvent(aType, canBubble, canCancel, aView, aDetail)
Argument list:aTypeA string containing the event type
canBubbleA boolean flag indicating whether the event can bubble
canCancelA boolean flag indicating whether the event can be cancelled
aViewA reference to an AbstractView object
aDetailA numeric detail value

A new event object is manufactured by calling the DocumentEvent.createEvent() method. That event should have been defined with a type specified as "UIEvent". If it was, then it will support an initUIEvent() method. This must be called before the event is dispatched, otherwise the event object will not contain enough information for the event dispatcher/handler to make sense of it and route it to the correct target objects.

The two boolean argument values define whether the event will be allowed to be cancelled, and what type of propagation to use (bubble or capture).

The view argument refers to an AbstractView object which DOM level 2 describes and which may not yet be well supported by any browser.

The detail value can be used to pass context information into the event handling chain.

See also:DocumentEvent.createEvent(), MouseEvent.initMouseEvent()