title: Best way to find DOM elements with css selectors
body: <p>What's the easiest way to find Dom elements with a css selector, without using a library?</p>
  
  <pre><code>function select( selector ) {
   return [ /* some magic here please :) */ ]
  };
  
  select('body')[0] // body;
  
  select('.foo' ) // [div,td,div,a]
  
  select('a[rel=ajax]') // [a,a,a,a]
  </code></pre>
  
  <p>This question is purely academical. I'm interested in learning how this is implemented and what the 'snags' are. What would the expected behavior of this function be? ( return array, or return first Dom element, etc ).</p>