W3C home > Mailing lists > Public > www-svg@w3.org > September 2011

Re: a minor confusion concerning mouse events

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Mon, 12 Sep 2011 01:46:15 -0700
Message-ID: <CAAWBYDAqycm93iVOte1LwZbKWZz2e2OZMYgS6Pt-uOokutDELQ@mail.gmail.com>
To: olli@pettay.fi
Cc: David Dailey <ddailey@zoominternet.net>, www-svg@w3.org
On Sun, Sep 11, 2011 at 9:44 PM, Olli Pettay <Olli.Pettay@helsinki.fi> wrote:
> On 09/10/2011 09:49 AM, Tab Atkins Jr. wrote:
>> IE exposes the much more useful (non-bubbling) mouseenter and
>> mouseleave events,
>
> mouseenter/leave are perhaps useful, but easily quite slow, since they
> need to be fired a lot more often.

Hm, this doesn't make sense to me.  Ignoring any optimizations based
on registration, it seems like enter/leave are still fired *less* than
over/out.  over/out get fired on *every* transition between elements.
You'll often only fire one of enter/leave on a given transition,
though.

One detail I'm not sure of without testing (which I can't do right now
on this Linux laptop) is a situation like, for example, two elements
each nested deeply in different branches, but placed next to each
other.  Presumably mousing from one to the other would fire mouseleave
events all the way up to their common node, and then mouseenter events
all the way back down.  I'm not sure if mouseover/out would do the
same or if they'd only fire once each.

(In any case, I imagine that non-bubbling events are amenable to more
aggressive registration-based pruning, right?  You can just keep a
record of what nodes have listeners, and make a quick check before
attempting to fire.)

~TJ
Received on Monday, 12 September 2011 08:47:04 GMT

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