Mozilla::DOM::DocumentEvent
Mozilla::DOM::DocumentEvent is a wrapper around an instance of Mozilla's nsIDOMDocumentEvent interface. This class inherits from Supports.
* The nsIDOMDocumentEvent interface is the interface to the event * factory method on a DOM document object. * * For more information on this interface please see * L<http:E<sol>E<sol>www.w3.orgE<sol>TRE<sol>DOM-Level-2-EventsE<sol>>
(In particular, sections 1.5 and 1.6. Very important to read that if you want to understand how to create an Event.)
Pass this to QueryInterface on a Document object to get back a DocumentEvent, like
$window = $browser->GetContentDOMWindow; $doc = $window->GetDocument; $iid = Mozilla::DOM::DocumentEvent->GetIID $docevent = $doc->QueryInterface($iid); $event = $docevent->CreateEvent('MouseEvents'); $event->InitEvent('click', 1, 1); ...
You can also print it out, and it will look like
{46b91d66-28e2-11d4-ab1e-0010830123b4}
$eventtype (string)
$event_type is a string, apparently one of 'Events', 'UIEvents', 'HTMLEvents', 'MutationEvents', 'KeyEvents', or 'MouseEvents'. See section 1.6 of the DOM Level 2 specs. Apparently 'KeyEvents' is not in DOM Level 2, but I was able to create them anyway.
The return value is an Event object. You can then call InitEvent. Or you can get the GetIID of UIEvent, MouseEvent, or MouseEvent, pass it to $event->QueryInterface, call the corresponding Init(UI|Mouse|Key)Event method. After that, call DispatchEvent on an EventTarget.
GetIID
Mozilla::DOM
Copyright (C) 2005-2007, Scott Lanning
This software is licensed under the LGPL. See Mozilla::DOM for a full notice.
To install Mozilla::DOM, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mozilla::DOM
CPAN shell
perl -MCPAN -e shell install Mozilla::DOM
For more information on module installation, please visit the detailed CPAN module installation guide.