Adjust the text nodes in an HTML DOM so that the document is pretty-printed when serialized
npm install domspaceAdjust the text nodes in an HTML DOM so that the document is pretty-printed when serialized.
Note that the supplied node and its children will be altered.
If you'd rather create a copy that's ready for pretty printing,
you can deep-clone it first using the DOM API:
``js`
const prettyNode = domspace(node.cloneNode(true));
``
npm install domspace
`js`
const domspace = require('domspace');
const myDiv = document.createElement('div');
myDiv.innerHTML = 'foo';
domspace(myDiv);
console.log(myDiv.outerHTML);
Output:
`html``
foo