in JSDOMParser.js [724:754]
function getHTML(node) {
var i = 0;
for (i = 0; i < node.childNodes.length; i++) {
var child = node.childNodes[i];
if (child.localName) {
arr.push("<" + child.localName);
// serialize attribute list
for (var j = 0; j < child.attributes.length; j++) {
var attr = child.attributes[j];
// the attribute value will be HTML escaped.
var val = attr.getEncodedValue();
var quote = !val.includes('"') ? '"' : "'";
arr.push(" " + attr.name + "=" + quote + val + quote);
}
if (child.localName in voidElems && !child.childNodes.length) {
// if this is a self-closing element, end it here
arr.push("/>");
} else {
// otherwise, add its children
arr.push(">");
getHTML(child);
arr.push("</" + child.localName + ">");
}
} else {
// This is a text node, so asking for innerHTML won't recurse.
arr.push(child.innerHTML);
}
}
}