Let\'s say that I define an element
$foo = $(\'#foo\');
and then I call
$foo.remove()
from some event. My
Agree with Perro's comment. It can also be done like this:
$foo.parents().last().is(document.documentElement);