title: CSS and jQuery Selector Speed
body: <p>In jQuery whenever I encounter something like this:</p>
  
  <pre><code>$("div#MyDiv").....
  </code></pre>
  
  <p>I generally say to the developer: "Don't bother putting the <code>div</code> in front of <code>#MyDiv</code>, ID selectors are the fastest." I.e.</p>
  
  <pre><code>$("#MyDiv")....
  </code></pre>
  
  <p>This is because the latter will hook directly into <code>document.getElementById</code> rather than having to scan the DOM for all <code>&lt;div&gt;</code> elements first.</p>
  
  <p>My question is, do the same rules apply to CSS selectors? I.e. rather than:</p>
  
  <pre><code>div#MyDiv
  {
  }
  </code></pre>
  
  <p>Is it faster to have simply?:</p>
  
  <pre><code>#MyDiv
  {
  }
  </code></pre>
  
  <p>(I realise that CSS selectors are incredibly fast anyway, so in reality neither would make a significant difference.)</p>
  
  <p>Many Thanks</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Any links, or references might be useful for the purposes of this discussion.  Thanks :-)</p>