jquery: when does $("???") scan the whole DOM?
<p>When using <code>$("#xxx")</code> I guess under the hoods jQuery uses <code>getElementById</code>.</p>

<p>What about <code>$(".xxx")</code> does it scan the whole DOM every time?</p>
