Closed YuMao233 closed 1 year ago
Sorry for replay so late. Would this help you?
function walk(root) {
let count = 0;
for (const node of root.childNodes) {
// To get or set HTML attributes, I have to get the HTMLElement object
// But I can only get its parent elements.
if (node instanceof HTMLElement) {
count+=forEachAttr(node as HTMLElement) // I want: node.currentElement
}
}
}
Am I understood?
Thanks for your reply, the problem has been solved.
I know that "Node.parentNode" can get an HTMLElement type, but this is an parent element, not itself.
Did I do something wrong?