Hi Patrick, > I don't quite get how I would also be able to pass in the class 'this' > instance to someFunc other than having a var foo = this; at the top of > the initialize block.. > > Can you see a way to get around that?
Since you replied to Jonathan that you wanted access to both #foo and the instance, that's probably how I'd do it. Alternately, you could use #bind as he suggested and then use event.findElement() to get the element that was actually clicked (which is *slightly* different from the element on which the handler was set [Prototype's default 'this' for handlers]). HTH, -- T.J. Crowder Independent Software Consultant tj / crowder software / com www.crowdersoftware.com On Apr 9, 5:44 pm, patrick <[email protected]> wrote: > Thanks for the reply T.J., > > When using 'this', one other problem comes up for me which I wasn't > sure how to address. I use lowpro along with prototype for it's > Event.addBehavior stuff... > > So, if I do: > > var Foo = (function() { > > var Foo = Class.create({ > initialize: function() { > > Event.addBehavior({ > '#foo:click': function() { > someFunc(this) > } > > }); > } > }) > > return Foo; > > })(); > > in thie '#foo:click' block, this is referring to the #foo element.... > I don't quite get how I would also be able to pass in the class 'this' > instance to someFunc other than having a var foo = this; at the top of > the initialize block.. > > Can you see a way to get around that? > > -patrick -- 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 [email protected]. 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.
