Sunday, November 1, 2009

[jQuery] Re: How to Select element with class, but EXCLUDE its children?

On Nov 1, 10:54 am, Andrei Eftimie <k3liu...@gmail.com> wrote:
> > Mousing over class="placemark" causes it to fire as if there was a
> > mouseover on class="Senate."  "placemark" has its own class, separate
> > from the "senate" class.
>
> This behaviour is actually the way it supposed to be.
> mouseover and mouseout fire on each entering / exiting of the elements
> and ever element descendants border.
>
> You would want mouseenter and mouseleave to fire *only* on the trigger
> element, and ignore its descendants.
>


Andrei, if this is the desired behavior, I don't understand why it
should be. The way I see it is, to use a simpler example:

<body class="class1">Goodbye
<div class="class2">Hello.</div>
</body>

$(".class1").onmouseover(....

$(".class2").onmouseover(....

So, when you mouever class2, it is pretty much pointless, because it
fires as if you mouse over class1.

No comments: