Re: Spec update: deviceorientation event should fire when listener is first registered

On 12/07/2011, at 9:50 PM, Anne van Kesteren wrote:

> On Tue, 12 Jul 2011 13:42:36 +0200, Andrei Popescu <andreip@google.com> wrote:
>> On Tue, Jul 12, 2011 at 12:41 PM, Anne van Kesteren <annevk@opera.com> wrote:
>>> I think firing when a new listener registers for the event is wrong. Tying that together goes against the event model. addEventListener() has no such side effects.
>> 
>> What exactly is it wrong with it? And what alternative would you
>> suggest to solve the given problem?
> 
> You could follow a similar design to http://www.whatwg.org/C#messageport that does have special handling for onmessage (or here ondeviceorientation), but not for addEventListener(). If you want to use addEventListener() you would have to invoke start().
> 
> The problem is that addEventListener() is supposed to be orthogonal to all this. We could change that, but I am not convinced it is a good idea.

I tend to agree with Anne here. We shouldn't change the understood behaviour of addEventListener(). If you really need an event to be fired, then we should expose a mechanism specifically for that.

Dean

Received on Tuesday, 12 July 2011 13:17:52 UTC