-
Notifications
You must be signed in to change notification settings - Fork 468
Closed
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is needed
Description
Would you be interested in a function like this? The only annoying thing I've found with using jsdom is that it's hard to debug if you don't know what's going on or are confused. In the browser you can just look at it, but you can't with jsdom. This gives me most of what I want:
function prettyDOM(node, indent = 0) {
let str = '';
if (node) {
str += ' '.repeat(indent) + (node.tagName || node.textContent) + '\n';
for (let child of node.childNodes) {
str += debugDOM(child, indent + 2);
}
}
return str;
}
You can now do console.log(prettyDOM(node))
and get an output like this in the terminal:
sompylasar and AustinGreen
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is needed