Fix regression with 'not visible' elements - this only works with HTMLElements, not SVG elements.
Merge the two methods existsInDOM and isElementInDOM