a element click and document click hierarchy
<p>If I run the following code I get, as expected, 1, because the a element is inside the div element.</p>

<p>HTML:</p>

<pre><code>&lt;div class=".holder"&gt;
  &lt;a href="#" class=".link"&gt;a&lt;/a&gt;
&lt;/div&gt;
</code></pre>

<p>jQuery:</p>

<pre><code>$(document).click(function (e) {
  alert($(e.target).closest(".holder").length);
});
</code></pre>

<p>Now, the inside a element needs to repopulate the div element, including the a element itself, so:</p>

<pre><code>$(".link").on("click", function (e) {
  e.preventDefault();
  $(".holder").html("some html");
});
</code></pre>

<p>The problem is: because the document click occurs after the a element click (makes sense, hierarchy), if I click the a element, I get 0 instead of 1, because the a element parent doesn't exist anymore, and the a element itself only exists in memory.</p>

<p>Is there a way to solve this without check for the a element click itself?</p>
