Re: Fwd: DOM event detection

Hi, Robin-

Many people suggest a more active feature-testing approach (e.g. testing 
to see if an event will fire, or if a method exists), but I believe that 
the current draft of DOM3 Events meets your needs.  You can use the 
existing .hasFeature() method along with discrete event interface and 
event name feature strings to detect support for any event in a 
conforming DOM3 Events UA.

 
http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html#feature-detection

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


Arthur Barstow wrote (on 12/21/10 6:51 AM):
>   Robin - www.dom may be a better place to discuss this.
>
> -------- Original Message --------
> Subject:  DOM event detection
> Resent-Date:  Tue, 21 Dec 2010 10:56:25 +0000
> Resent-From:  <public-webapps@w3.org>
> Date:  Mon, 20 Dec 2010 23:44:24 +0000
> From:  ext Robin Winslow <robin@robinwinslow.co.uk>
> To:  <public-webapps@w3.org>
>
>
>
> After a brief correspondence with Robin Berjon he suggested I post this
> suggestion here.
>
> After having problems with detecting support for the HTML5 'input' event
> (http://goo.gl/XNSg5 http://goo.gl/rAa5f) I started wondering if there
> was a DOM specification for detecting support for DOM events in browsers.
>
> After a brief email correspondence with Robin Berjon, and looking around
> a bit myself, it appears that there is no specific mention of this in
> the current HTML5 or DOM specifications. There is some mention of DOM
> events being exposed as methods (http://goo.gl/TYm2k) but this may not
> necessarily apply to all DOM elements.
>
> Therefore, I'd like to suggest that we try to come up with a standard
> way of suggesting that support for DOM elements be exposed, to enable
> developers to tell which events are supported.
>
> One method that works in Webkit and Gecko for many methods, although I
> don't think it's in any W3C specification, is to include methods for
> each event them in the "Event" object, e.g.:
>
> 'CLICK' in Event; // true
> 'CHANGE' in Event; // true
> 'INPUT' in Event; // false
>
> Does that seem like a reasonable method of DOM event support detection?
> Could it be included as a recommendation in the specification somewhere?
>
> Cheers,
> Robin.

Received on Wednesday, 22 December 2010 19:57:14 UTC