title: Get CSS path from Dom element
body: <p>I got this function to get a cssPath :</p>
  
  <pre><code>var cssPath = function (el) {
    var path = [];
  
    while (
      (el.nodeName.toLowerCase() != 'html') && 
      (el = el.parentNode) &&
      path.unshift(el.nodeName.toLowerCase() + 
        (el.id ? '#' + el.id : '') + 
        (el.className ? '.' + el.className.replace(/\s+/g, ".") : ''))
    );
    return path.join(" > ");
  }
  console.log(cssPath(document.getElementsByTagName('a')[123]));
  </code></pre>
  
  <p>But i got something like this : </p>
  
  <pre>html > body > div#div-id > div.site > div.clearfix > ul.choices > li</pre>
  
  <p>But to be totally right, it should look like this :<pre>html > body > div#div-id > div.site:nth-child(1) > div.clearfix > ul.choices > li:nth-child(5)</pre></p>
  
  <p>Did someone have any idea to implement it simply in javascript ?</p>