[whatwg] Mechanism to find available events

On 29/12/2010, at 08:27, Ian Hickson wrote:
> On Mon, 20 Sep 2010, Biju wrote:
>> 
>> We need
>> HTMLNode.getSupportedEvents()  ==> returns a text array of event names
>> HTMLNode.isSupportedEvent(eventName)  ==> returns true/false
>> 
>> Many times in particular version of browser we dont know whether an
>> HTMLNode/window support particular event.
>> Or what are the alternate events available, so that we can refer some
>> document or do some test to find how it can be used.
>> So I wish we had above methods available.
> 
> What do you mean by "supports an event"? You can dispatch any event you 
> want to any event target.

It's not you, it's whether *the*browser* dispatches it. Say, oncontextmenu : "The code specified by this attribute is called when the associated element is right-clicked or when the mouse button is held down long enough to generate a contextual menu."

How could your program detect, unequivocally, that the browser it's running in would dispatch an oncontextmenu when "the element is right-clicked or when the mouse button is held down long enough to generate a contextual menu" ?

We need a mechanism to detect accurately the features of the browser our code's running in, without relying to UA sniffing madness.
-- 
Jorge.

Received on Wednesday, 29 December 2010 03:07:19 UTC