[whatwg] Should onfoo event handler properties be on Element or HTMLElement?

Erik Dahlström ed at opera.com
Wed Jan 22 06:06:25 PST 2014


On Tue, 08 Oct 2013 20:21:08 +0200, Boris Zbarsky <bzbarsky at mit.edu> wrote:

> On 10/8/13 9:49 AM, Philip Jägenstedt wrote:
>> Gecko has "HTMLElement implements GlobalEventHandlers" in its IDL,[1]
>> but somewhat surprisingly also "SVGElement implements
>> GlobalEventHandlers".[2]
>
> Note that in Gecko SVG elements also have event handler content  
> attributes and whatnot.
>
> What's your proposed handling of event handler content attributes?  And  
> note that the handling of these is not quite identical for HTML and SVG  
> last I checked.  :(
>
> -Boris

There are a couple of events in SVG which seem to be in conflict with the  
reflection pattern.

The events with names: "endEvent", "beginEvent" and "repeatEvent" [1]. The  
attributes that correspond to these are "onend", "onbegin" and "onrepeat"  
respectively. Due to how the event-value syntax[2] works in SVG animation  
elements the event names can't be changed without conflicting with the  
sync-base value syntax[3].

I wish the event names were consistent with the pattern used for event  
handler content attributes, but they're not.

In SVG2 most of the events with "SVG" event name prefixes have been  
removed[4], e.g "SVGLoad" is now a plain "load", which means they follow  
the pattern for event handler content attributes.

SVGResize, SVGScroll and SVGZoom still remain to be fixed in the spec. Of  
these only SVGZoom lacks an existing unprefixed counterpart, so that would  
be a possible addition to GlobalEventHandlers with the event name "zoom".

My question is: what should be done with the SVG specific event handlers?  
Should they be added to GlobalEventHandlers, or should they be just on  
SVGElement?

This was ACTION-3542 (SVG WG).

[1] http://www.w3.org/TR/SVG11/interact.html#BeginEvent
[2] http://www.w3.org/TR/SVG11/animate.html#EventValueSyntax
[3] http://www.w3.org/TR/SVG11/animate.html#SyncbaseValueSyntax
[4] https://svgwg.org/svg2-draft/interact.html#SVGEvents

-- 
Erik Dahlstrom, Web Technology Developer, Opera Software
Co-Chair, W3C SVG Working Group


More information about the whatwg mailing list