On Dec 27 2008, 3:38 am, kangax <[email protected]> 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) {
e.stop();
alert(e.element().href);
}
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,
Eric
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---