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: Sat, 10 Sep 2011 09:49:01 -0700
Message-ID: <CAAWBYDBXiNX_Lu1hdCH_p4BSXuco58j7wv8MngU3Np1ccPNGdQ@mail.gmail.com>
To: David Dailey <ddailey@zoominternet.net>
Cc: www-svg@w3.org
On Sat, Sep 10, 2011 at 8:19 AM, David Dailey <ddailey@zoominternet.net> wrote:
> I suspect someone will easily convince me that the confusion is my own
> rather than the spec’s but compare the two examples:
>
> http://granite.sru.edu/~ddailey/svg/animstart1old.svg
> and
> http://granite.sru.edu/~ddailey/svg/animstart1.svg
>
> In the first, the oval changes colors, onmouseover and onmouseout (listeners
> being associated with the group it belongs to). However, the text object
> within the group seems to hijack that event, making it change colors again
> when the mouse approaches the text.
>
> I’m able to “fix” this in the second example by putting a
> pointer-events=”none” on the text, but the idea that I would have to tell
> the text to be quiet so it doesn’t disturb the group events seems a bit
> counter-intuitive.  Opera, FF, and webkit all seem to agree with each other,
> but ASV seems to agree with me.

That's how mouse events work.  Mouseover fires any time you enter an
element, and it bubbles, so descendants end up throwing a lot of
annoying noise around.  Mouseout is the same.  Those events are really
hard to use properly.

IE exposes the much more useful (non-bubbling) mouseenter and
mouseleave events, but I don't think any other browser supports them.

~TJ
Received on Saturday, 10 September 2011 16:49:57 GMT

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