title: JavaScript getElement by href?
body: <p>I've got the script below</p>
  <pre><code>var els = document.getElementsByTagName(&quot;a&quot;);
  for(var i = 0, l = els.length; i &lt; l; i++) {
    var el = els[i];
    el.innerHTML = el.innerHTML.replace(/link1/gi, 'dead link');
  }
  </code></pre>
  <p>However this searches through the page and takes about 20 seconds to do it as there are LOTS of links.</p>
  <p>However I only need to target the <code>a</code>'s that have a specific <code>href</code>, for eg. <code>http://domain.example/</code></p>
  <p>So ideally I'd like to be able to do this in a similar fashion to jQuery, but without using a framework. So something like</p>
  <pre><code>var els = document.getElementsByTagName(&quot;a[href='http://domain.example']&quot;);
  </code></pre>
  <p>How would I go about doing this so it only searches the objects with that matching <code>href</code>?</p>