title: How to compare event.target to a selector
body: <p>In my function, I am taking a node type, <code>node</code>, and attaching an <code>onclick</code> to every node in the document on that type. </p>
  
  <p>Then I want to look at the element that was clicked and "bubble up" i.e. add an effect to the node above it that would be selected by <code>selector</code>.</p>
  
  <p>The problem is, that the selector my function takes could be a class, a tag, an id, etc...</p>
  
  <p><strong>So what do I compare <code>target</code> to</strong> (in the portion with the surrounding *'s)<strong>?</strong></p>
  
  <pre><code>function myFunc(node, event, selector){
  
      var elements = document.querySelectorAll(node);
  
      for (var i = 0; i &lt; elements.length; i++){
           elements[i].onclick = function(event){
              var target = event.target;
               while (target != node){
                   **if (target == selector) **
                          applyEffects(target);
               }
               target = target.parentNode;
          };   
      }
  
  }
  </code></pre>
  
  <p>Also - I am not allowed to use JQuery.
  (This is part of a homework assignment, but my question is not directly related to it)</p>