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

On Wed, 13 Jul 2011 15:27:19 +0200, Andrei Popescu <andreip@google.com>  
wrote:
> But I don't think that's a good idea for the reasons explained in my
> previous email on this thread. Furthermore, that seems to contradict
> the DOM Level 3 Event specification which clearly states in section
> 4.3 that:
>
> "Note: In addition to the EventTarget.addEventListener method, some
> host languages may allow a content author to register event listeners
> by the use of attributes, e.g., onclick="handleClick()". Because the
> details of this are often language-specific, this type of event
> listener registration is not defined in this specification, but in
> general, any event type may be used as an attribute in this way by
> adding the prefix on- to the event type name, and events so dispatched
> should behave consistently with the event registration and propagation
> defined in this specification, with the same interfaces, properties,
> and methods."
>
> http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html#interface-EventTarget
>
> Furthermore, HTML 5, section 6.1.6.1 says on the same topic:
>
> "All event handlers on an object, whether an element or some other
> object, and whether set to null or to a Function object, must be
> registered as event listeners on the object when it is created, as if
> the addEventListener() method on the object's EventTarget interface
> had been invoked"
>
> http://dev.w3.org/html5/spec/Overview.html#event-handler-attributes
>
> How does your proposal comply with the "should behave consistently"
> and "as if the addEventListener() had been invoked"  sentences above?

I do not really see how it contradicts it. Setting the attribute does that  
*and* causes an event to be dispatched (or starts some process in the case  
of MessagePort). The pattern was discussed a while back on the WHATWG list.


> I guess the intent here was to say that adding a new event listener is
> an event activation trigger. I couldn't find any guidelines anywhere
> about what can and cannot be an activation trigger....

Well,  
http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-eventtarget-addeventlistener  
is pretty clear on what addEventListener() does. It does not involve  
dispatching events.


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

Received on Wednesday, 13 July 2011 13:38:57 UTC