Re: [DOMCore] fire and dispatch

2011-03-05 Thread Brendan Eich
2. Run getters and define in which order they are retrieved This can get pretty hard to specify (esp. because it involves describing what happens if those getters reenter the API you're defining). Why is that particularly hard? Calling fireEvent (or whatever it will be called) twice on a

Re: [DOMCore] fire and dispatch

2011-03-02 Thread Jonas Sicking
On Tue, Mar 1, 2011 at 5:06 AM, Anne van Kesteren ann...@opera.com wrote: On Tue, 01 Mar 2011 09:59:59 +0100, Jonas Sicking jo...@sicking.cc wrote: We're also using it in IndexedDB, though I don't think this has gotten into the spec drafts yet. But it is in the firefox implementation and I

Re: [DOMCore] fire and dispatch

2011-03-02 Thread Anne van Kesteren
On Wed, 02 Mar 2011 11:52:01 +0100, Jonas Sicking jo...@sicking.cc wrote: I'm not quite sure what you mean by via JSON given that JSON is a serialization format. I thought that maybe there was some kind of concept that tells you whether a given object is JSON-compatible. But yeah, if we

Re: [DOMCore] fire and dispatch

2011-03-02 Thread Boris Zbarsky
On 3/2/11 5:52 AM, Jonas Sicking wrote: I'm not quite sure what you mean by via JSON given that JSON is a serialization format. The idea would be to take the input object, sanitize it by doing obj = JSON.parse(JSON.serialize(obj)); (which will get rid of crud like getters), and then work

Re: [DOMCore] fire and dispatch

2011-03-02 Thread Ojan Vafai
On Thu, Mar 3, 2011 at 1:46 AM, Boris Zbarsky bzbar...@mit.edu wrote: On 3/2/11 5:52 AM, Jonas Sicking wrote: I'm not quite sure what you mean by via JSON given that JSON is a serialization format. The idea would be to take the input object, sanitize it by doing obj =

Re: [DOMCore] fire and dispatch

2011-03-01 Thread Garrett Smith
On 2/28/11, Anne van Kesteren ann...@opera.com wrote: On Fri, 25 Feb 2011 18:47:54 +0100, Garrett Smith dhtmlkitc...@gmail.com wrote: Your example is simple. But some common cases of synth events are complicated. UI Events aren't so bad but MouseEvents and especially TouchEvents are a lot of

Re: [DOMCore] fire and dispatch

2011-03-01 Thread Anne van Kesteren
On Tue, 01 Mar 2011 09:00:27 +0100, Garrett Smith dhtmlkitc...@gmail.com wrote: Mouse.click(document.body, {clientX : 10}); Yeah, that would be simpler. However, we do not really have this pattern anywhere in browser APIs and I believe last time we played with objects (for namespace

Re: [DOMCore] fire and dispatch

2011-03-01 Thread Ojan Vafai
On Tue, Mar 1, 2011 at 7:23 PM, Anne van Kesteren ann...@opera.com wrote: On Tue, 01 Mar 2011 09:00:27 +0100, Garrett Smith dhtmlkitc...@gmail.com wrote: Mouse.click(document.body, {clientX : 10}); Yeah, that would be simpler. However, we do not really have this pattern anywhere in

Re: [DOMCore] fire and dispatch

2011-03-01 Thread Jonas Sicking
On Tue, Mar 1, 2011 at 12:48 AM, Ojan Vafai o...@chromium.org wrote: On Tue, Mar 1, 2011 at 7:23 PM, Anne van Kesteren ann...@opera.com wrote: On Tue, 01 Mar 2011 09:00:27 +0100, Garrett Smith dhtmlkitc...@gmail.com wrote: Mouse.click(document.body, {clientX : 10}); Yeah, that would be

Re: [DOMCore] fire and dispatch

2011-03-01 Thread Anne van Kesteren
On Tue, 01 Mar 2011 09:59:59 +0100, Jonas Sicking jo...@sicking.cc wrote: We're also using it in IndexedDB, though I don't think this has gotten into the spec drafts yet. But it is in the firefox implementation and I *think* in the chrome implementation. The issue raised with it last time (by

Re: [DOMCore] fire and dispatch

2011-03-01 Thread Boris Zbarsky
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

Re: [DOMCore] fire and dispatch

2011-03-01 Thread Aryeh Gregor
On Tue, Mar 1, 2011 at 8:51 AM, Boris Zbarsky bzbar...@mit.edu wrote: 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

Re: [DOMCore] fire and dispatch

2011-03-01 Thread Ian Hickson
On Tue, 1 Mar 2011, Aryeh Gregor wrote: On Tue, Mar 1, 2011 at 8:51 AM, Boris Zbarsky bzbar...@mit.edu wrote: 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

Re: [DOMCore] fire and dispatch

2011-02-28 Thread Anne van Kesteren
On Fri, 25 Feb 2011 18:47:54 +0100, Garrett Smith dhtmlkitc...@gmail.com wrote: Your example is simple. But some common cases of synth events are complicated. UI Events aren't so bad but MouseEvents and especially TouchEvents are a lot of work to synthesize. Most cases for synth events are for

Re: [DOMCore] fire and dispatch

2011-02-25 Thread Anne van Kesteren
On Fri, 25 Feb 2011 04:05:44 +0100, Garrett Smith dhtmlkitc...@gmail.com wrote: OK. Why not expose a generic version of `fire` to the scripting environment? I do not know of any research (or have done any myself) as to how often such a feature might be useful for authors. While firing an

Re: [DOMCore] fire and dispatch

2011-02-25 Thread Garrett Smith
On 2/25/11, Anne van Kesteren ann...@opera.com wrote: On Fri, 25 Feb 2011 04:05:44 +0100, Garrett Smith dhtmlkitc...@gmail.com wrote: OK. Why not expose a generic version of `fire` to the scripting environment? I do not know of any research (or have done any myself) as to how often such a

Re: [DOMCore] fire and dispatch

2011-02-25 Thread João Eiras
On , Garrett Smith dhtmlkitc...@gmail.com wrote: On 2/25/11, Anne van Kesteren ann...@opera.com wrote: On Fri, 25 Feb 2011 04:05:44 +0100, Garrett Smith dhtmlkitc...@gmail.com wrote: OK. Why not expose a generic version of `fire` to the scripting environment? I do not know of any research

Re: [DOMCore] fire and dispatch

2011-02-25 Thread Garrett Smith
On 2/25/11, João Eiras joao.ei...@gmail.com wrote: On , Garrett Smith dhtmlkitc...@gmail.com wrote: On 2/25/11, Anne van Kesteren ann...@opera.com wrote: On Fri, 25 Feb 2011 04:05:44 +0100, Garrett Smith dhtmlkitc...@gmail.com wrote: [...] Most cases for synth events are for testing --

[DOMCore] fire and dispatch

2011-02-24 Thread Anne van Kesteren
For DOM Core Ms2ger and I (and some others on IRC) decided to introduce a subtle distinction between fire and dispatch. Dispatching is actually going through the list of event targets with an initialized event whereas firing is initializing the event and then dispatching it. E.g. a

Re: [DOMCore] fire and dispatch

2011-02-24 Thread Garrett Smith
On 2/24/11, Anne van Kesteren ann...@opera.com wrote: For DOM Core Ms2ger and I (and some others on IRC) decided to introduce a subtle distinction between fire and dispatch. Dispatching is actually going through the list of event targets with an initialized event whereas firing is initializing