I didn't think of this earlier (and I'm not going to block this diff), but we should probably consider using `Node.ELEMENT_NODE` and `Node.DOCUMENT_NODE`).