Re: [DOMCore] fire and dispatch

On 3/1/11 3:48 AM, Ojan Vafai wrote:
>         Mouse.click(document.body, {clientX : 10});
...

> The Chromium extension APIs use this pattern and I think it's gone over
> well in that space. For example, see chrome.contextMenus.create at
> http://code.google.com/chrome/extensions/contextMenus.html. I don't see
> a problem with beginning to introduce this into web APIs, but it would
> be a departure from existing APIs.

The big worry here is that you have to be _very_ careful to define 
behavior properly.  It's not an issue for extension APIs, where you can 
assume that the caller will do sane (and probably non-malicious) things. 
  But for a web API like this you would need to define exactly when and 
how many times the UA is supposed to get the "clientX" property of the 
second argument, for example.  That's a minimal requirement; there are 
probably other ratholes here that would need worrying about.  :(

Alternately, we could require that all the properties be plain data 
properties or something, to avoid some of those pitfalls.

-Boris

Received on Tuesday, 1 March 2011 13:57:47 UTC