Hi,

some form controls (radio, checkbox, maybe others...) have a native
click() method that toggles them, so that would be in conflict I
suppose.


Pavel

On 2 pro, 10:36, Luke <kickingje...@gmail.com> wrote:
> Hi,
>
> I think it's pretty annoying to write
>
> myelement.observe('click', function(event){
>         // do stuff
>         event.stop()
>
> });
>
> for every link etc for which you want to replace the click-
> functionality. So I added a Method to Element that does the observer-
> invoking and event-stopping for me and simply named it click. Like
> with jQuery, the event only keeps bubbling if the given eventHandler
> returns true.
>
> Element.addMethods({
>         click: function(element, eventHandler) {
>                 if (!(element = $(element))) return;
>                 element.observe('click', function(event){
>                         if(!eventHandler(event))
>                                 event.stop()
>                 });
>                 return element;
>         }
>
> });
>
> But I'm wondering. 'click' sounds like a name to me that could easily
> cause conflicts. It works in Safari and FF though. Does anyone know if
> there could be sideeffects or nameconflicts?
>
> Thanks
> Lukas

-- 
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-scriptacul...@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.

Reply via email to