W3C home > Mailing lists > Public > www-dom@w3.org > July to September 2009

Re: Can Dispatch canDispatch()?

From: Stewart Brodie <stewart.brodie@antplc.com>
Date: Fri, 28 Aug 2009 11:19:05 +0100
To: <www-dom@w3.org>
Message-ID: <7c7aa74c53a2b5a59fd951ba8d4a654578941320@localhost>
Garrett Smith <dhtmlkitchen@gmail.com> wrote:

> Explanation of what the proposed - EventTarget - method - hasEvent -
> would potentially do, before weighing pros and cons.
> 1. document.body.hasEvent("click")
> 2. document.documentElement.hasEvent("submit")
> 3. document.forms[0].hasEvent("focus")
> 1. true  -- the body will fire click
> 2. false -- this element does not fire "submit" events
> 3. true  -- this element can, if it has a tabIdex, fire focus events

I don't understand what tabindex has to do with it...?   How about:

4.  document.getElementsByTagName("span")[0].hasEvent("focus")

Now take into account that there may be a binding that allows this SPAN
element in this document to accept focus.  IOW, a simple static table is not
going to do the trick - I have to determine all this information
dynamically.  That's just not feasible, IMHO.

> The method name "hasEvent" is probably best renamed to "firesEvent".


> For each new event, implementers must consider "firesEvent", to make sure
> that it would not return false positives, breaking working pages.

I just don't think that is feasible, given ~75 different events and ~120
different HTML element types (I'm ignoring the non-HTML ones for now!), plus
having to compute the value at run-time.

Stewart Brodie
Software Engineer
ANT Software Limited
Received on Friday, 28 August 2009 10:19:46 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:15 UTC