[whatwg] Detecting eventListeners

Xavier Ho contact at xavierho.com
Thu May 24 20:07:03 PDT 2012


Hello Kyle,

On 25 May 2012 12:56, Kyle Huey <me at kylehuey.com> wrote:
>
> I'll bite.  Why do you care if an EventTarget has registered event
> listeners or not?
>

We're working on an internal script that does something similar to Selenium
IDE plugin on Firefox, which records user interactions based on page
submission, event triggers, and form input.

A very common use-case is to record a mouse click on a DOM element which
may fire an event on the page.  We want to capture clicks that actually
triggered an event, does a HTTP request, and so on, but not meaningless
clicks on an empty region.

That said, there is no way of surely determining if a click is meaningful.
 We check if the DOM element clicked on is a button, a link (has href), has
onclick attribute set, and so on.  However, this will fail on sites that
binds 'click' via 'addEventListener' on a strange element, like a <span> or
a <em> tag.

We are developing this script for user training and customer tutorials -- a
playback script that moves the mouse, types in forms, interacts with the
webpage -- which so far is almost complete.

Feel free to ask any questions.  I'm the main developer on this project.

Cheers,
Xav



More information about the whatwg mailing list