GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  HTML::DOM::EVENT (3)

.ds Aq ’

NAME

HTML::DOM::Event - A Perl class for HTML DOM Event objects

CONTENTS

VERSION

Version 0.056

SYNOPSIS



  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
  );
  # OR:
  $event->init(
      type => click,
      propagates_up => 1,
      cancellable => 0,
  );

  $doc->body->dispatchEvent($event); # fake event (run the handlers)
  $doc->body->trigger_event($event); # real event



DESCRIPTION

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.

METHODS

    DOM Attributes

These are all read-only and ignore their arguments.
type The type, or name, of the event, without the ’on’ prefix that HTML attributes have; e.g., ’click’.
target This returns the node on which the event occurred. It only works during event propagation.
currentTarget 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.
eventPhase Returns one of the constants listed below. This only makes sense during event propagation.
bubbles This attribute returns a list of Bubble objects, each of which has a diameter and a wobbliness, which can be retrieved by the corresponding get_* methods. :-)

Actually, this strangely-named method returns true if the event propagates up the hierarchy after triggering event handlers on the target.

cancelable Returns true or false.
timeStamp Returns the time at which the event object was created as returned by Perl’s built-in time function.

    Other DOM Methods

initEvent ( $name, $propagates_up, $cancelable ) This initialises the event object. $propagates_up is whether the event should trigger handlers of parent nodes after the target node’s handlers have been triggered. $cancelable determines whether preventDefault has any effect.
stopPropagation If this is called, no more event handlers will be triggered.
preventDefault If this is called and the event object is cancelable, HTML::DOM::EventTarget’s dispatchEvent method will return false, indicating that the default action is not to be taken.

    Non-DOM Methods

init This is a nice alternative to initEvent. It takes named args:



  $event->init(
      type => click,
      propagates_up => 1,
      cancellable => 1,
  );



and returns the $event itself, so you can write:



  $node->dispatchEvent( $doc->createEvent(...)->init(...) );



It also accepts target as an argument. This allows you to trigger weird events that have the target set to some object other than the actual target. (dispatchEvent will not set the target if it is already set.)

cancelled Returns true if preventDefault has been called.
propagation_stopped Returns true if stopPropagation has been called.

EXPORTS

The following node type constants are exportable, individually or with ’:all’:
CAPTURING_PHASE \fIs0(1)
AT_TARGET \fIs0(2)
BUBBLING_PHASE \fIs0(3)

SEE ALSO

HTML::DOM

HTML::DOM::Event::UI

HTML::DOM::Event::Mouse

HTML::DOM::Event::Mutation

HTML::DOM::Node

POD ERRORS

Hey! <B>The above document had some coding errors, which are explained below:B>
Around line 446: =over without closing =back
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 HTML::DOM::EVENT (3) 2016-02-28

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.