Re: a minor confusion concerning mouse events

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 UTC