[Proto-Scripty] Re: onClick vs Element.observe

2009-11-19 Thread ColinFine
On Nov 18, 2:00 pm, Eric lefauv...@gmail.com wrote: Hi, I also think delegation is the better approach. However, I did notice that none of the examples was dealing with the case where the user click on something that is not a '.item'. You may want to do something like this: function

[Proto-Scripty] Re: onClick vs Element.observe

2009-11-18 Thread ColinFine
On Nov 17, 10:17 pm, phegaro pheg...@gmail.com wrote: Delegation sounds like a good model for doing this although if i want to pass parameters that are custom to each node like which id did it click on then i assume i have store it as a property on the node and pass arguments to the delgated

[Proto-Scripty] Re: onClick vs Element.observe

2009-11-18 Thread Eric
Hi, I also think delegation is the better approach. However, I did notice that none of the examples was dealing with the case where the user click on something that is not a '.item'. You may want to do something like this: function doIt(e) { var element = e.findElement('.item'); if(element

[Proto-Scripty] Re: onClick vs Element.observe

2009-11-17 Thread ColinFine
On Nov 16, 11:27 pm, phegaro pheg...@gmail.com wrote: Hi all,   I have an app that is going to put out a list of items onto a page and each one has a number of click targets. Now i could setup the event handler in one of two ways. 1. add it into the template that is rendered with the

[Proto-Scripty] Re: onClick vs Element.observe

2009-11-17 Thread david
Hi phegaro, the difference is not about cross browser, because both method is cross browser. first method come the DOM0 specification and the second one is DOM2. The big difference is that the DOM0 event could only have ONE definition. But for the DOM2 event, you'll have the possibility to

[Proto-Scripty] Re: onClick vs Element.observe

2009-11-17 Thread phegaro
Delegation sounds like a good model for doing this although if i want to pass parameters that are custom to each node like which id did it click on then i assume i have store it as a property on the node and pass arguments to the delgated function? In the above example if doIt took a paramter of