Avoid using the previous workaround when the node we are given is already the document element.