Testing different methods of checking whether an element is or is in another element. Start from the position where you have jquery objects. Make === or parentNodes a function call. Check that alternatives return the correct answer. Try with a container selector rather than element (the main advantage() of closest()). Without redundant check.
Comparing performance of: !!closest.length vs == and parentNodes vs !!closest.length selector vs == and parentNodes selector