Re: [jquery-dev] Change "this" when binding element

2009-12-23 Thread Daniel Friesen
Bad place for the scope. This is what anonymous inline functions are for. There's also ES5's fn.bind(this); which can be implemented in ES3 as a prototype. Your example is also a little screwed up with it's use of document. this.a = '1'; var that = this; $(document).bind('scroll', function() { th

Re: [jquery-dev] Change "this" when binding element

2009-12-23 Thread John Resig
The upcoming jQuery 1.4 already has: .bind("click", fn, scope) --John On Wed, Dec 23, 2009 at 10:06 AM, Amina wrote: > Cross-posted Jquery-group: > > I am suggestion for new small feaute in jQuery. > add a new proeprty to "bind" function. a Scope property. > sometimes I am binding a function

[jquery-dev] Change "this" when binding element

2009-12-23 Thread Amina
Cross-posted Jquery-group: I am suggestion for new small feaute in jQuery. add a new proeprty to "bind" function. a Scope property. sometimes I am binding a function inside object. So I need a solution to change the scope of this function. something like: $().bind('click',data,scop