That would make sense if those static methods didn't return something else already. $.ajax and the various variants like $.get return the XMLHttpRequest object. $.trim returns the trimmed string, $.map an array etc.
Jörn On Thu, Oct 9, 2008 at 7:37 PM, Shade <[EMAIL PROTECTED]> wrote: > > Jorn-Thank you for the answer. I guess I had never really picked up > on the difference. Technically, it would seem that even all the > static jQuery functions could be "chainable" too, but I guess > stylistically that's reserved for methods, when there's a capture-set > of elements to chain/pass, not just wanting to save code space by > being able to chain multiple static calls together. > > I was trying to be lazy and call several static methods in a row, > rather than saying "jQuery" each time. My bad. :) > > > On Oct 9, 10:52 am, "Jörn Zaefferer" <[EMAIL PROTECTED]> > wrote: >> None of the static jQuery methods are chainable, that is, return a >> jQuery object. That rule applies only to instance methods. >> >> Instance: $().someMethod >> Static: $.someMethod >> >> The plugin guide could be fixed to reflect that difference... >> >> Jörn >> >> >> >> On Thu, Oct 9, 2008 at 5:26 PM, Shade <[EMAIL PROTECTED]> wrote: >> >> > I was playing around with the new XHR plugin system that will be out >> > with 1.2.7/1.3, and I noticed something that seemed a little odd to >> > me. >> >> > I was using the ajaxSetup() function to change my transport, but I >> > wanted to chain off the end of that call, and it doesn't work, because >> > apparently ajaxSetup doesn't return the "jQuery" object. >> >> > I had been reading and trying to diligently follow the Plugin >> > Authoring guide here:http://docs.jquery.com/Plugins/Authoring >> >> > which says: "Your method must return the jQuery object, unless >> > explicity noted otherwise." >> >> > Perhaps I'm missing something, and if so I apologize, but I would have >> > expected ajaxSetup to be chainable since it's API definition doesn't >> > *explicitly* say it isn't. Is this a misunderstanding on my part, a >> > documentation deficiency, or a possible suggestable improvement to >> > ajaxSetup? >> >> > Is there a reason why ajaxSetup shouldn't be chainable?- Hide quoted text - >> >> - Show quoted text - > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery Development" 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/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~---
