W3C home > Mailing lists > Public > www-svg@w3.org > January 2006

Re: [SVGMobile12] listener element

From: Maciej Stachowiak <mjs@apple.com>
Date: Mon, 30 Jan 2006 23:41:30 -0800
Message-Id: <C06F658F-792D-4ED8-9D3C-2C85F7EF8328@apple.com>
Cc: www-svg@w3.org
To: Robin Berjon <robin.berjon@expway.fr>


On Jan 12, 2006, at 11:55 AM, Robin Berjon wrote:

> On Jan 12, 2006, at 20:40, Maciej Stachowiak wrote:
>> My own proposal (in another comment) was to drop the incompatible  
>> XML Events support and bring back onfoo style inline event  
>> handlers. The combination of these and the DOM API is convenient  
>> enough and sufficient for most purposes.
>
> A large set, possibly the majority, of events that I've used so far  
> in SVG Tiny 1.2 development have been "foreign events", that is  
> events specific to the functionality I'm using and not in the spec.  
> The onfoo attributes won't help there (they don't really help with  
> Java either). Using the DOM API for those would be quite  
> inconvenient when you're dealing with a bunch of components that  
> you hope don't have to interact much at the script level.

Using the DOM API with an inline script block actually is not much  
more verbose than an inline <handler> element. The <handler> version:

<circle xml:id="myCircle" x="10" y="10">
<handler type="application/ecmascript" ev:event="MyCustomEvent">
customEventHandler(evt);
</handler>
</circle>

Or, if you want to attach the event external to the

<circle xml:id="myCircle" x="10" y="10"></circle>

......

<ev:listener event="MyCustomEvent" observer="#myCircle"  
handler="#myEventHandler" />
<handler type="application/ecmascript" id="myEventHandler">
customEventHandler(evt);
</handler>


Compare:

<circle xml:id="myCircle" x="10" y="10" />

....

<script type="application/ecmascript">
document.getElementById("myCircle").addEventListener("MyCustomEvent",  
customEventHandler, false);
</script>

Even for this fairly advanced use case (I have yet to run into a web  
site that uses foreign events), the DOM version is not significantly  
more verbose than the inline <handler> element, and is actually less  
verbose for specification of the event handler separately from the  
event target element.

> If the difference in XML Events (which the HTML WG has agreed to)  
> are too violently disagreed with here, I'd rather we remove the  
> deltas (or at least the less compatible ones) than remove XML  
> Events support.

I think fixing the incompatibilities seems like a bare minimum. But  
my suggestion to remove XML Events and bring back onfoo attributes  
still stands. They seem more awkward for simple cases, and no better  
for complex cases.

Regards,
Maciej
Received on Tuesday, 31 January 2006 07:41:37 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:33 GMT