visit method
Implementation
void visit(Node node) {
return switch (node.nodeType) {
Node.ELEMENT_NODE => visitElement(node as Element),
Node.TEXT_NODE => visitText(node as Text),
Node.COMMENT_NODE => visitComment(node as Comment),
Node.DOCUMENT_FRAGMENT_NODE =>
visitDocumentFragment(node as DocumentFragment),
Node.DOCUMENT_NODE => visitDocument(node as Document),
Node.DOCUMENT_TYPE_NODE => visitDocumentType(node as DocumentType),
_ => throw UnsupportedError('DOM node type ${node.nodeType}')
};
}