W3C home > Mailing lists > Public > whatwg@whatwg.org > April 2011

[whatwg] Mechanism to find available events

From: Garrett Smith <dhtmlkitchen@gmail.com>
Date: Fri, 29 Apr 2011 17:19:24 -0700
Message-ID: <BANLkTikO_NnLASK4bR+Qc5QexwveDJp1MA@mail.gmail.com>
On 4/29/11, Ian Hickson <ian at hixie.ch> wrote:

[...]
>> We need a mechanism to detect accurately the features of the browser our
>> code's running in, without relying to UA sniffing madness.
>
> No such mechanism can exist without actually using the feature, because
> there's no way to guarantee that a browser will accurately report what it
> supports. Every time we've had such a feature (e.g. DOM hasFeature())
> vendors have ended up returning inaccurate values.
>

Is it possible to design something better than hasFeature?

Method hasFeature can be expected to have the problems it has because
it is not related to any specific object (Node, window, document). As
such, this method requires the implementation (browser) to make an
unreasonable generalization. Requiring the unreasonable is
unreasonable.

If instead, there were a method designed to check the object in
question, it could be specified to require the implementation also
check that object's capabilities.

I'm not suggesting unequivocal (e.g. right click triggers a context
menu) -- that seems too much. I'm suggesting a more closely related
inference check.

Is a mechanism such as this possible? Why rule it out?

>
> On Wed, 29 Dec 2010, Garrett Smith wrote:
>>
>> However, how can a program determine if a particular event is generated
>> by the browser and fired at a particular object? The `("onhashchange" in
>> window)` test should theoretically work, but as mentioned, that isn't
>> interoperable at this point.
>
> Neither is a mechanism to find out if an event is going to be fired. :-)
>

The *proposed* mechanism isn't interoperable -- is that what you're hinting at?

New events are what will need to be detected. Just like contextmenu
was not interoperable at one point. Now if, prior to that, there had
been a mechanism to determine if contextmenu events, the developer
would not know exactly under which circumstances that would occur, but
he would at least be in a better position to judge than using
existence inference?

> Let's get what we have already got implemented correctly before adding new
> features that do more or less the same thing.
>
Already got what?
-- 
Garrett
Received on Friday, 29 April 2011 17:19:24 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 30 January 2013 18:48:03 GMT