DOM event detection

2010-12-21 Thread Robin Winslow
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.


Re: DOM event detection

2010-12-21 Thread Robin Winslow
I read Kangax's post, but I hadn't actually seen the tool on github, thanks
for that.

The way that one would hope Fx might support it is by providing an oninput
method on the INPUT element and allowing you to support it that way.

However, regardless of whether this is a bug in Fx or not, the main point is
that the DOM specs as they stand don't actually specify a way that browsers
should be exposing DOM event support. This is what I'm hoping we can change,
so in future there's a reliable method of detecting DOM event support in all
browsers.

Robin.

On 21 December 2010 22:37, Ryan Seddon seddon.r...@gmail.com wrote:

 It's actually a bug in Firefox[1] which unfortunately been around for a
 very long time, since 2003, and isn't isolated just on the input event it
 also affects the invalid event. For detecting events kangax has created a
 handy method called isEventSupported[2] which will detect 99% of events
 successfully, albeit not input or invalid events in FF due to the above
 mentioned bug.

 [1] https://bugzilla.mozilla.org/show_bug.cgi?id=195696
 [2] http://kangax.github.com/iseventsupported/

 -Ryan


 On Tue, Dec 21, 2010 at 10:44 AM, Robin Winslow 
 ro...@robinwinslow.co.ukwrote:

 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.