Initial reaction: "Boo, you suck". It's called local variables. I've found chaining can sometimes lead to bad readability of code. Chaining is good when doing things like setting multiple attributes or .click(function(){}).click()
There has to be a line drawn somewhere
It is of course missing at least one:
"Never do in jquery what your browser can do internally"
How many of you have ever done this?
$.post(...., function(data){
var d = $(data);
d.click();
$(..., d).doSomething();
applyHandlers(d /*context*/);
$("content").append(d);
});Yes well the above is TERRIBLE coding. Because d is now parsed, built, and stored by jquery... in the javascript space. If you were to do the following:
{
$("#content").append(d);
var d = $("#d'sId");
// do rest of work
}You would make your code 1) faster, and 2) use less memory in the javascript space. Thus large ajax requests process much faster. Thus don't do in jquery what your browser can do natively, like build and store dom.