> Even more than that, if you were to return $(this) you wouldn't be chaining
> on the original object.
>
>     // Return the same object that this function was
>     // called as a method of (i.e. the jQuery object).
>     return this;
>
>     // Return a *new* jQuery object that contains the
>     // same DOM elements as this (probably not what
>     // you want).
>     return $(this);

That helped clear up some confusion on my part...


> Thomas, you're right that there's nothing new about chaining. Sometimes
> people think that jQuery introduced the technique, but it's been common
> practice in JavaScript and other languages for a long time. For example:
>
>     var s1 = 'Testing 123';
>     var s2 = s1.replace( '123', '456' ).toUpperCase();

You're dead on. I really did think this was a new scripting technique.
For whatever reason, I completely forgot that you can do this in the
core JS language.

Reply via email to