Is it possible to override Element#observe to do this automatically? -Hector
On Fri, Nov 21, 2008 at 10:26 AM, Matt Foster <[EMAIL PROTECTED]>wrote: > > To elaborate on Kangax's idea, a DOM element is a dynamic object, > being that you can add custom properties which can be referenced for > further processing... > > var ele = new Element("div"); > ele.eventHandles = { click : handleClick, mouseover : > handleMouseOver }; > ele.observe("click", ele.eventHandles.click); > ele.observe("mouseover", ele.eventHandles.mouseover); > > ... > > > var clone = ele.cloneNode(true); > > for(var key in ele.eventHandles) > clone.observe(key, ele.eventHandles[key]); > > > > > > > > On Nov 21, 10:58 am, kangax <[EMAIL PROTECTED]> wrote: > > On Nov 21, 7:06 am, anthyon <[EMAIL PROTECTED]> wrote: > > > > > Hi, > > > > > is there any way, to access the event handlers of an element > > > registered through prototype? > > > > > when i create a new element, i need to copy some property including > > > event handlers, and sometimes when i put an event handler on an > > > element later i would like to register the same handler for another > > > event on the same element. > > > > > is it possible? > > > > Sure. > > Store a reference to your event handler and then "attach" it to > > another element later on. > > > > > > > > > thx > > > Anthyon > > > > -- > > kangax > > > --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~----------~----~----~----~------~----~------~--~---