Under what conditions do chained jQuery objects offer performance gains?
<p>I'm working with some code that adds and removes various CSS classes on the same object. The code looks something like:</p>

<pre><code>function switch_states(object_to_change) {
  if(object_to_change.hasClass('ready') {
    object_to_change.removeClass('ready');
    object_to_change.addClass('not_ready');
  } else {
    object_to_change.removeClass('not_ready');
    object_to_change.addClass('ready');
  }
}
</code></pre>

<p>I suspect I might be able get away with chaining these two snippits into something like <code>object_to_change.removeClass('ready').addClass('not_ready');</code> But I have to wonder: besides legibility and the neato factor, does this give me any performance gains?</p>

<p>My question: Would a chained objects do their work any faster than two non-chained ones? If so, why? If not, at what point does using chained objects become more efficient than disparate ones -- i.e. under what conditions do chained jQuery objects offer performance gains?</p>
