On Dec 27 2008, 3:38 am, kangax <kan...@gmail.com> wrote:
> document.observe('click', function(e, el) {
>   if (el = e.findElement('.myClassName')) {
>     e.stop();
>     alert(e.element().href);
>   }
> })

Wouldn't it be:
if ((el = e.findElement('.myClassName'))!=document) {


Prototype 1.6 Complete API Reference claims that Event.findElement
returns the document if no matching element is found :o)

Subsidiary question:
Would something like this do the same, and what are the disadvantages
comparing to your solution:

$$('a.myClassName').invoke('observe','click',function(e) {

Since we are in this area, the API Reference guide is unclear about
the correct prototype of event handler functions, and I cannot found
what is supposed to be its second argument (I am betting on
event's .element() object but I could use a confirmation :o) ).

Thanks in advance,

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 prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to