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

Re: Can Dispatch canDispatch()?

From: Sean Hogan <shogun70@westnet.com.au>
Date: Fri, 28 Aug 2009 12:59:22 +1000
Message-ID: <4A97480A.3000003@westnet.com.au>
To: Olli@pettay.fi
CC: DOM public list <www-dom@w3.org>
Olli Pettay wrote:
>>>>
>>>> But how would the hasEvent() work with plugins, extensions or
>>>> greasymonkey scripts? All those can create random events using
>>>> the normal DOM Events API.
>>>>
>>>
>>> If they want to dispatch trusted events they will have to register with
>>> the browsers internal events table.
>>> Otherwise they can always provide their own equivalent of hasEvent().
>>>
>>
>> What has trusted events to do with hasEvent()?
>> (AFAIK, trusted events are gecko specific thing.)
>
> (And in gecko nothing needs to be registered "with the browsers 
> internal events table" to be able to dispatch trusted events.
> Privileged script can dispatch trusted events.)
>


I don't see this being an issue. I'm not familiar with how plugins, etc 
integrate with the browser, so the following suggestions may not be 
valid. Please correct as appropriate.

If a plugin is dispatching a proprietary event then I don't think it 
matters if document.hasEvent() doesn't report it. The plugin may choose 
to provide its own lookup, eg: myPlugin.hasEvent().

If the plugin is providing a standard event because the browser doesn't 
implement it, then hasEvent() should report it.
Either
    the browser allows the plugin to register an event-type so that 
document.hasEvent() can report it,
Or
    the plugin overwrites document.hasEvent(), eg:

document._hasEvent = document.hasEvent;
document.hasEvent = function(ns, type) {
    return myPlugin.hasEvent(ns, type) || this._hasEvent(ns, type);
}
Received on Friday, 28 August 2009 03:00:49 GMT

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