title: JavaScript/jQuery: hasDescendant / hasAncestor
body: <p>Hilariously, I'm having incredible difficulty finding any half-good way to determine whether or not an HTML element is inside another one or not -- which seems like it should be a basic core feature of traversing and analyzing the HTML DOM. I was immensely surprised and disappointed that the "hasDescendant" (or likewise) method is missing.
  <br /><br /></p>
  
  <p>I'm trying to do this:</p>
  
  <pre><code>var frog = $('#frog');
  var walrus = $('#walrus');
  if (frog.hasDescendant(walrus)) console.log("Frog is within walrus.");
  else console.log("Frog is outside walrus.");
  </code></pre>
  
  <p><br /><br />
  I've tried to reproduce what I'm looking for with many jQuery combinations.</p>
  
  <pre><code>walrus.is(frog.parents());
  walrus.has(frog);
  walrus.find(' *').has(frog);
  frog.is(walrus.find(' *'));
  </code></pre>
  
  <p><br /><br />
  I haven't found a working solution yet.</p>
  
  <hr>
  
  <p><em>[edit]</em><br />
  <strong>Solution:</strong> <code>walrus.has(frog)</code><br />
  <strong>Alternate:</strong> <code>if (walrus.has(frog)) { doStuff(); }</code><br />
  <strong>Alternate:</strong> <code>var booleanResult = walrus.has(frog).length&gt;0;</code></p>
  
  <hr>
  
  <p>//Chase.</p>