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

On Tue, 12 Jul 2011 18:43:23 +0200, Wojciech Masłowski  
<wmaslowski@opera.com> wrote:
> I think you misunderstood me - what I meant is not that it doesn't make  
> a difference from compatibility point of view if a browser sends an  
> event or not, but that that it only matters for the first event you  
> receive and not really that much for later events unless you rely on  
> something you really shouldn't anyway.

Sites will rely on that. Silly stuff happens on the web all the time. When  
designing APIs for the web you have to assume they are going to be used  
incorrectly.


> If we are to be really picky then adding event listener for device  
> orientation enables the device compass which is a side effect. Other  
> would be sending an empty event to signal that the runtime cannot  
> provide values. Do you suggest that orientation doesn't fit DOM Events  
> model and it should something else, for example the same approach as  
> geolocation?

You could have the same approach as MessagePort as I mentioned elsewhere.


> PS: Can you point me to any point in the DOM Events spec that states  
> that addEventListener cannot have any side effects?

Specifications work the other way around. The events specification does  
not say it can have side effects and therefore it cannot (unless we modify  
it).


-- 
Anne van Kesteren
http://annevankesteren.nl/

Received on Wednesday, 13 July 2011 12:29:52 UTC