[Proto-Scripty] Event.on bound to element only

2011-12-20 Thread kstubs
Api reads:  

callback (Function http://api.prototypejs.org/language/Function/) – The 
event handler function. Should expect two arguments: the event object *and* the 
element that received the event. (If selector was given, this element will 
be the one that satisfies the criteria described just above; if not, it 
will be the one specified in the element argument). This function is *always
* bound to element.

So this means there is no way to bind to a class, to *this* class?  Most of 
the time it makes sense that the event listener is bound to the class and 
not the element.  Are there any possibilities of allowing you to pass 
context to the on function?

Karl..

-- 
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/prototype-scriptaculous/-/DawaWjvEe6gJ.
To post to this group, send email to prototype-scriptaculous@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.



Re: [Proto-Scripty] Event.on bound to element only

2011-12-20 Thread Guillaume Lepicard
Hi Karl

You should have a look to Element.observe
With this method you can bind the listener to the object you want

The main difference is that you don't have the selector. Nevertheless,
thanks to $$ and invoke, you should get what you want

Guillaume
Le 21 déc. 2011 08:39, kstubs kst...@gmail.com a écrit :

 Api reads:

 callback (Function http://api.prototypejs.org/language/Function/) – The
 event handler function. Should expect two arguments: the event object *and
 * the element that received the event. (If selector was given, this
 element will be the one that satisfies the criteria described just above;
 if not, it will be the one specified in the element argument). This
 function is *always* bound to element.

 So this means there is no way to bind to a class, to *this* class?  Most
 of the time it makes sense that the event listener is bound to the class
 and not the element.  Are there any possibilities of allowing you to pass
 context to the on function?

 Karl..

 --
 You received this message because you are subscribed to the Google Groups
 Prototype  script.aculo.us group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/prototype-scriptaculous/-/DawaWjvEe6gJ.
 To post to this group, send email to
 prototype-scriptaculous@googlegroups.com.
 To unsubscribe from this group, send email to
 prototype-scriptaculous+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://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 prototype-scriptaculous@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.