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

Can Dispatch canDispatch()? (was: Detecting and Creating Events)

From: Doug Schepers <schepers@w3.org>
Date: Wed, 26 Aug 2009 15:21:55 -0400
Message-ID: <4A958B53.1030807@w3.org>
To: DOM mailing list <www-dom@w3.org>
Hi, Folks-

It seems that canDispatch() needs to be fixed or forgotten.  So far as 
we can tell, it's not widely implemented.  None of Firefox, IE, Opera, 
or WebKit seem to support it.  Batik does support it [1], but I couldn't 
find any discussion of its use [2].  DOM3 Events is just a draft, so we 
can change it, if we need to.

So, my questions to this list are:
* Is the functionality in canDispatch() needed?
** If it's not needed, should we drop the feature, in the interest of 
interop and speed to market?
** If it is needed, is canDispatch() sufficiently and usefully specified?
*** If it's not sufficiently and usefully specified:
**** what specifically needs to be clarified, and could people propose 
wording?
**** should we specify something else instead, and if so, what should 
the feature look like?

Garrett's counter-proposal did not seem to satisfy any of the other 
implementers, and I confess that I'm skeptical that we could design 
something from scratch in the next few weeks that would solve the 
problem and get universal support.  So, if we can't fix canDispatch() 
easily, I'm tempted to drop it from the spec, and approach the problem 
another way, in another spec dedicated just to event delegation.

Thoughts?

[1] 
http://xmlgraphics.apache.org/batik/javadoc/org/w3c/dom/events/DocumentEvent.html
[2] 
http://www.nabble.com/forum/Search.jtp?forum=308&local=y&query=canDispatch

Regards-
-Doug Schepers
W3C Team Contact, SVG and WebApps WGs


Garrett Smith wrote (on 8/23/09 3:54 PM):
> On Thu, Aug 20, 2009 at 4:32 AM, Stewart
> Brodie<stewart.brodie@antplc.com>  wrote:
>>  Garrett Smith<dhtmlkitchen@gmail.com>  wrote:
>>
>>>  The inability to easily and accurately detect events is a problem.
>>>  Programs want to know if an event is implemented at runtime. If it is,
>>>  then the feature can be used. If not, it a fallback stratety is in
>>>  order. Many new event types are being created and implemented. How can
>>>  a program feature-test to see if they are implemented?
>>
>>  DocumentEvent.canDispatch() would seem to fit the bill, although it's not
>>  clear exactly what criteria this method is supposed to base its answer on
>>  right now.
>
> I see. It wouldn't really "fit the bill", unless it did, but since we
> don't know if it does, it must seem so.
>
>
> You could suggest a clarification for the text and then you
>>  don't need to add all those new methods.
>>
>
> No, that "canDispatch" sounds like almost as bad an idea as
> hasFeature. I learned not to trust crap like that quite good many
> years ago.
>
> About canDispatch, if an implementation performs an internal test,
> actually dispatching and returning the event, then it would be
> trustable. However, creating and dispatching an event would has
> obvious side effects.
>
> [...]
Received on Wednesday, 26 August 2009 19:22:07 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:14:03 GMT