Switching to use a better check for if the node is a document.