And... wouldn't isElementInDOM also acheive the same thing? It's checked 1x line up, but recursively looks for parent nodes, until it finds one that is a document object.