title: How do you test for equivalence between two HTML elements or jQuery selectors?
body: <p>Can you write a function that sees if two pieces of DOM are equivalent?  It should ignore irrelevant whitespace.  Ideally, it should also ignore empty attributes.</p>
  
  <p>So the following should be equal:</p>
  
  <pre><code>&lt;div style=""&gt;
  &lt;div&gt;a&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>and  </p>
  
  <pre><code>&lt;div&gt;&lt;div&gt;a&lt;/div&gt;&lt;/div&gt;
  </code></pre>