title: Plain javascript equivalent of $(document).on(event) with selector
body: <p>I'm trying to convert a jQuery event handler to pure javascript. There are loads of a particular selector on the page, so this was designed with only one event targeting document with that selector:</p>
  
  <pre><code>$(document).on("click", selectorString, function(event) {
   // do stuff
  });
  </code></pre>
  
  <p>Where <code>selector</code> is a list of selectors as a string "<code>.one, .two, .three</code>".</p>
  
  <p>I'm struggling to replicate this without jQuery though:</p>
  
  <pre><code>document.addEventListener("click", function(event){
      if (elementHasClass(event.target, selectorString) {
          // do stuff
      }
  });
  </code></pre>
  
  <p>But this doesn't have the desired behaviour, as the listener is only on the <code>document</code> element, rather than the selected element <em>within</em> the document. Can anyone help with this?</p>