title: Performance using JS querySelector
body: <p>When using JavaScript in the web browser is there any performance difference between the following:</p>
  
  <p>Existing getElementById</p>
  
  <pre><code>document.getElementById("elem");
  </code></pre>
  
  <p>Query Selector using #id</p>
  
  <pre><code>document.querySelector("#elem");
  </code></pre>
  
  <p>Query Selector using [id=elem]</p>
  
  <pre><code>document.querySelector("[id=elem]");
  </code></pre>
  
  <p>I'm assuming the first one will be fastest (only has to lookup elements with an ID). Also the final one looks like bad practice. I like the second one as using querySelector for everything makes the code easy to read.</p>
  
  <p>Any suggestions?</p>