jQuery instanceof Function => true jQuery.prototype instanceof Function => false
Both ‘bind’ methods do what they are intended to do and do not interfere with each other. On Jul 22, 8:10 pm, aHeckman <aaron.heckm...@gmail.com> wrote: > I see your points. Since jQuery.prototype.bind exists it overrides > Function.prototype.bind. Gotcha. > > What I'm really trying to get at is if this community feels the > following is clear, and if not, is it worth the trouble to change it? > > > jQuery(someElement).bind('click', someFunction.bind(this)); > > So far it sounds like we feel this is good enough. > > On Jul 22, 10:05 am, Scott González <scott.gonza...@gmail.com> wrote: > > > > > jQuery.bind doesn't exist, jQuery.prototype.bind does (therefore .bind > > is not in the context of a function). > > > Furthermore, I don't see how this gives the wrong impression at all; > > nobody expects to be able to call arbitrary methods on a jQuery object > > just because a function exists on some other global object like > > Function, String, Date, etc. > > > On Jul 22, 8:11 am, aHeckman <aaron.heckm...@gmail.com> wrote: > > > > Since jQuery itself is a function, jQuery.bind gives the wrong > > > impression - even though binding jQuery to anything else wouldn't work > > > anyway. > > > > On Jul 21, 2:23 pm, Julian Aubourg <aubourg.jul...@gmail.com> wrote: > > > > > I've been watching this thread from afar and I don't really get it. > > > > This is OO programming and it's quite common to have different classes > > > > having methods with the same name but different semantic (obviously > > > > since, > > > > again, they are different classes). > > > > > someFunction.bind() has semantic within the Function world, > > > > jQuery.bind() > > > > has semantic within the jQuery world. > > > > > I mean, I wouldn't mind a .reverse() method for a string, an array or a > > > > video, perfectly knowing they obviously wouldn't behave the same. > > > > > Unless a new pure Object method appears which name clashes with jQuery, > > > > I > > > > see no reason to break backward compatibility to circumvent what > > > > happens to > > > > be a feature in an OO programming language. Aren't we thinking a little > > > > "Pascal" here? ;) > > > > > 2009/7/14 aHeckman <aaron.heckm...@gmail.com> > > > > > > With the inclusion of Function.prototype.bind in ECMAscript 5, I'd > > > > > like to open discussion around possibly modifying the API around bind/ > > > > > unbinding events. I feel changing jQuery would help keep it's API > > > > > cleaner. For example, the following seems dirty and will cause > > > > > unnecessary confusion: > > > > > > jQuery.bind('click', someFunction.bind(this)); > > > > > > Maybe listen/unlisten, watch/unwatch, or something similar would be > > > > > better. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-dev@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 -~----------~----~----~----~------~----~------~--~---