Re: on<event> attributes as global attributes

On Fri, 25 Jun 2010, Dominique Hazael-Massieux wrote:
> Le jeudi 24 juin 2010 à 18:55 +0000, Ian Hickson a écrit :
> > On Thu, 24 Jun 2010, Dominique Hazael-Massieux wrote:
> > > http://dev.w3.org/html5/spec/elements.html#global-attributes
> > > The specs mentions that:
> > >         "While these attributes apply to all elements, they are not
> > >         useful on all elements. For example, only media elements will
> > >         ever receive a volumechange  event fired by the user agent."
> > > Why couldn't these events attributes only be defined for the relevant
> > > elements then?
> > 
> > It makes implementations easier.
> 
> Could you be maybe a bit more specific?

Implementations just have to implement all the event handlers in one 
place, rather than having to implement event handlers all over the place 
in the old model.


> One of the drawbacks I see is that it makes it harder to explain to 
> authors/developers what e.g. onvolumechange means on the title element.

onvolumechange is an event listener for the 'volumechange' event, on any 
element. The event is fired by implementations on the <video> and <audio> 
elements automatically, and can be fired on any event target using script 
that manually dispatches an event.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Friday, 25 June 2010 07:44:58 UTC