I saw this discussion about how native events cannot be fired by Element.fire and how that could be solved with a custom-event proxy http://groups.google.com/group/rubyonrails-spinoffs/browse_thread/thread/1facda5a22418beb/cce2efcecb42bb6e?lnk=gst&q=observe+native+event#cce2efcecb42bb6e Can any of you more experienced Prototype/JavaScript coders give me feedback on this solution? It adds a method to Element that lets me register for native events and automatically create a proxy. Are there any sideeffects I'm not aware of to doing this? (I'm an experienced Java coder, but very new to JavaScript and the dynamic prototype-style of coding). Element.addMethods({ createObserverProxy:function(ele,evt,proxy_evt,handler) { ele.observe(evt,function(){this.fire(proxy_evt)},false); if(handler instanceof Array) { for(var i = 0; i <handler.length; i++) { ele.observe(proxy_evt,handler,false); } } else { ele.observe(proxy_evt,handler,false); } } });
on 09.07.2008 14:44
on 09.07.2008 14:44
Hi, We've started transitioning to a new, better-named, hopefully-spam- free group for Prototype and script.aculo.us: http://groups.google.com/group/prototype-scriptaculous/ prototype-scriptaculous@googlegroups.com Could you please post your question there instead? Thanks! People might still answer here, but probably not for all that much longer... -- T.J. Crowder tj / crowder software / com On Jul 9, 12:59 pm, "andy.kri...@gmail.com" <andy.kri...@gmail.com>