I want to know if a certain element is in the document.
I tried two options and i want to know which one is the best in terms of resources.
1)
var $lastParent = $(element).parents().last();
var nodeName = $lastParent.prop('nodeName').toLowerCase();
var isInDocument = (nodeName == 'html');
2)
var isInDocument = document.contains(element);