title: How do I check if 2 jQuery selectors are pointing to the same element(s)?
body: <p>If I try something such as this:</p>
  
  <pre><code>$(".foo") === $(".foo") // = false
  </code></pre>
  
  <p>... I get false. If I instead try this query,</p>
  
  <pre><code>$(".foo").get(0) === $(".foo").get(0) // = true
  </code></pre>
  
  <p>... I get true.</p>
  
  <p>That's because:</p>
  
  <pre><code>{a:myObject} !== {a:myObject};
  [myObject]   !== [myObject];
  myObject     === myObject;
  </code></pre>
  
  <p>I'm wondering if there is any succinct way to test for this equality, preferably built into jQuery. The 2nd method I wrote only works correctly if there is at most one element which matches <code>.foo</code>. The solution should work for any amount of elements.</p>
  
  <p>Obviously I don't want to just check <code>".foo" === ".foo"</code> since the actual selections I'm using are more complicated. I just simplified them for this example. (E.g. I may want to check that <code>$(this)</code> is selecting the same thing as <code>$(".foo")</code>.)</p>