You can't use usual delegation (from mootools-more). However since it's
SVG/VML, I think the events bubble like normal DOM. So if you subscribe
(addEvent equivalent) an event to an element, which contains other elements,
the parent elements will fire the event as well. So you could inspect the
event object (probably the first argument) to see if there's something
useful.
myElement.subscribe('click', function(event){
console.dir(event);
});
Probably you can't check for event.target.tagName or use
Slick.match(event.target, 'a.class'); because the tagnames might be
different between SVG and VML. You should probably experiment a bit because
I'm not sure about it either yet ;)
On Wed, Jan 26, 2011 at 4:23 AM, Barry van Oudtshoorn <
[email protected]> wrote:
Jumping on the bandwagon... I've been playing with ART a bit, and I've got
> to say that I'm quite enjoying it.
>
> However, I'm not entirely sure about event handling -- particularly
> delegation. Let's say I want to render a line-graph (which I do), and allow
> the user to hover over points in that graph to see more detailed
> information, or click on those points to perform some action. Yes, I can add
> events to each point that I render, but that could cause trouble when the
> number of points starts getting high. It also doesn't feel very tidy. I
> understand that the complexity here is probably because of the difference
> between SVG and VML.
>
> Any ideas on an elegant solution? Is this something that's been considered
> for ART's future, and, if so, what's the best way forward in the light of
> that?
>
> - Barry
>
> http://barryvan.com.au/
> [email protected]
>
>