You could use a closure to ensure you're dealing with the right
element.
$$('.my_table td').each(function(cell){
cell.observe('mouseover', listener.curry(cell));
});
function listener(cell, evt){
if(evt.element() != cell)
return false;
}
Are you trying to have a clean way to avoid flickering?
--
http://positionabsolute.net
On Dec 19, 7:00 pm, Tobie Langel <[email protected]> wrote:
> var elm = evt.findElement('td');
>
> is exactly the same as doing:
>
> var elm = evt.element();
> if(elm.tagName.toString().toLowerCase() != 'td') elm = elm.up
> ('td');
>
> Only it'll accept any kind of CSS selector.
>
> On Dec 19, 3:38 pm, Walter Lee Davis <[email protected]> wrote:
>
> > I'll give that a try. I'm not sure (from the API docs) if that's going
> > to do exactly what I want or not.
>
> > Thanks,
>
> > Walter
>
> > On Dec 19, 2009, at 9:23 AM, ColinFine wrote:
>
> > > On Dec 18, 5:51 pm, Walter Lee Davis <[email protected]> wrote:
> > >> I use this construction quite a lot:
>
> > >> var elm = evt.element();
> > >> if(elm.tagName.toString().toLowerCase() != 'td') elm =
> > >> elm.up('td');
>
> > >> whenever I am constructing a rollover listener, since it works around
> > >> the whole issue with mouseover / out events firing whenever you move
> > >> over a child of the element you're trying to observe. Is there a
> > >> simpler way to do this, a more Prototype-y way, that is? I've had a
> > >> look around the API, and I also had a Google, but the former didn't
> > >> turn up anything useful and the latter turned up every commit message
> > >> from every project that includes Prototype.
>
> > > I belive that is what Element.findElement is for.
>
> > > Colin
>
> > > --
>
> > > You received this message because you are subscribed to the Google
> > > Groups "Prototype & script.aculo.us" group.
> > > To post to this group, send email to
> > > [email protected]
> > > .
> > > To unsubscribe from this group, send email to
> > > [email protected]
> > > .
> > > For more options, visit this group
> > > athttp://groups.google.com/group/prototype-scriptaculous?hl=en
> > > .
--
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en.