I like to think of Event#findElement as the equivalent of the XPath
expression self-or-ancestor. I use it a lot for delegated observers,
like placing one click listener on a common parent element, then using
$('parentElement').observe('click', function(evt){
if (evt.findElement('a#foo')){
evt.stop();
//do something
}
});
That element (a#foo) might not be the same thing as evt.element() in
all browsers, particularly if that anchor wraps around an image.
(Firefox likes to keep up the idea that the image received the click,
not the a that's wrapped around it.) But evt.findElement will always
find the right element.
Walter
On Sep 20, 2010, at 4:07 PM, Jason wrote:
What you have written makes sense with the findElement. Can
findElement by used to literally find any element and then compare it
to find out if it is a child or parent of the relevant div. This way I
could determine if the clicked element is part of the open div, if it
isn't I could then hide the div.
--
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.