Agreed, that is slick. As soon as I get back to the office I'm going to test 
it, I look forward to this.



-- Sent from my Palm Prē
aHeckman wrote:

Yeah this looks good Peter. This should be in core IMHO.



BTW, you're running for president? LOL



On Dec 29, 9:24 am, Peter Higgins <phigg...@gmail.com> wrote:

> ... this is why I keep suggesting making the bind functionality as

> explicit function call, rather than hidden away in one or two api's:

>

> http://higginsforpresident.net/js/static/jq.hitch.js

>

> It does not extend any native prototypes, is useful and a bit magic

> (with the string->method resolution).

>

> Regards,

> Peter

>

>

>

> aHeckman wrote:

> > I too feel relying on a function.prototype.bind implementation would

> > be the most forward looking but I'm not sure that jives with the

> > general approach of jQuery:

>

> > jQuery doesn't extend Native.prototype.anything.

>

> > On Dec 29, 1:12 am, Daniel Friesen <nadir.seen.f...@gmail.com> wrote:

>

> >> Rick Waldron wrote:

>

> >>> Available, as in the "scope" argument is being retrofitted to an

> >>> existing function, and ONLY to that function.

>

> >>>     I don't get what you are talking about a fn.bind() implementation in

> >>>     jQuery, or what you mean by available in just one function though.

>

> >>> Read ES5.

>

> >>> function.prototype.bind()

>

> >> I already read ES5, I use portions of ES5 in a number of js server-based

> >> projects already.

>

> >> However I don't get "ONLY" one function, since the whole point of

> >> .bind() is to bind a `this` onto ONE function with one call. It's not

> >> bind otherwise.

>

> >> So I don't see any limitation. Unless you are under the

> >> misinterpretation that after you have called .bind() on one function you

> >> have modified that function and bound it's `this`. .bind() doesn't

> >> modify the function, it returns a new one.

> >>  From ES5 15.3.4.5 Function.prototype.bind> The bind method takes one or 
> >> more arguments, thisArg and (optionally)

>

> >>> arg1, arg2, etc, and returns a *new*

> >>> function object by performing the following steps:

>

> >> So this is valid ES5 code.

>

> >> "use strict";

> >> var a = function() { alert(this); };

> >> var a1 = a.bind("a");

> >> var a2 = a.bind("b");

>

> >> a(); // Alerts undefined

> >> a1(); // Alerts "a"

> >> a2(); // Alerts "b"

>

> >>> On Mon, Dec 28, 2009 at 7:43 PM, Daniel Friesen

> >>> <nadir.seen.f...@gmail.com <mailto:nadir.seen.f...@gmail.com>> 
> >>> wrote:

>

> >>>     I made a post about how confusing people may find the name bind some

> >>>     time ago. Suggested renaming bind to something like event, and keeping

> >>>     bind as an alias of course. That was rejected.

>

> >>>     I don't get what you are talking about a fn.bind() implementation in

> >>>     jQuery, or what you mean by available in just one function though.

>

> >>>     ~Daniel Friesen (Dantman, Nadir-Seen-Fire)

> >>>     [http://daniel.friesen.name]

>

> >>>     Rick Waldron wrote:

> >>>     > John,

>

> >>>     > While I'm glad to see a scope arg available, i still think this is

> >>>     > negligent to the future of jQuery and ES standards. I really think a

> >>>     > fn.bind() implementation would ideal (since it would be jQuery-wide

> >>>     > and not just available in one function), but as I've noted in

> >>>     the past

> >>>     > and is exampled here, beginners may find this syntax a bit boggling:

>

> >>>     > $(foo).bind('event', fn.bind(bar) );

>

> >>>     > Rick

>

> >> ~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://daniel.friesen.name]

>

> > --

>

> > You received this message because you are subscribed to the Google Groups 
> > "jQuery Development" group.

> > To post to this group, send email to jquery-...@googlegroups.com.

> > To unsubscribe from this group, send email to 
> > jquery-dev+unsubscr...@googlegroups.com.

> > For more options, visit this group 
> > athttp://groups.google.com/group/jquery-dev?hl=en.



--



You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.

To post to this group, send email to jquery-...@googlegroups.com.

To unsubscribe from this group, send email to 
jquery-dev+unsubscr...@googlegroups.com.

For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en.






--

You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to jquery-...@googlegroups.com.
To unsubscribe from this group, send email to 
jquery-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en.


Reply via email to