HTML::DOM::Event - A Perl class for HTML DOM Event objects
use HTML::DOM::Event ':all'; # get constants use HTML::DOM; $doc=new HTML::DOM; $event = $doc->createEvent; $event->initEvent( 'click', # type 1, # whether it propagates up the hierarchy 0, # whether it can be cancelled ); $doc->body->dispatchEvent($event);
This class provides event objects for HTML::DOM, which objects are passed to event handlers when they are triggered. It implements the W3C DOM's Event interface and serves as a base class for more specific event classes (or at least it will, when those are implemented).
These are all read-only and ignore their arguments.
The type, or name, of the event, without the 'on' prefix that HTML attributes have; e.g., 'click'.
This returns the node on which the event occurred. It only works during event propagation.
The returns the node whose handler is currently being called. (The event might have been triggered on one of its child nodes.) This also works only during event propagation.
Returns one of the constants listed below. This only makes sense during event propagation.
This attribute returns a list of
Bubbleobjects, each of which has a
wobbliness, which can be retrieved by the corresponding get_* method. :-)
Actually, this strangely-named method returns true if the event propagates up the hierarchy after triggering event handlers on the target.
Returns true or false.
Returns the time at which the event object was created as returned by Perl's built-in
Other DOM Methods
- initEvent ( $name, $propagates_up, $cancelable )
This initialises the event object.
$propagates_upis whether the event should trigger handlers of parent nodes after the target node's handlers have been triggered.
preventDefaulthas any effect.
If this is called, no more event handlers will be triggered.
If this is called and the event object is cancelable, HTML::DOM::Node's
dispatchEventmethod will return false, indicating that the default action is not to be taken.
Returns true if
preventDefaulthas been called.
Returns true if
stopPropagationhas been called.
The following node type constants are exportable, individually or with ':all':
- CAPTURING_PHASE (1)
- AT_TARGET (2)
- BUBBLING_PHASE (3)
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 208:
=over without closing =back