in JSDOMParser.js [1243:1260]
parse(html, url) {
this.html = html;
var doc = (this.doc = new Document(url));
this.readChildren(doc);
// If this is an HTML document, remove root-level children except for the
// <html> node
if (doc.documentElement) {
for (var i = doc.childNodes.length; --i >= 0; ) {
var child = doc.childNodes[i];
if (child !== doc.documentElement) {
child.remove();
}
}
}
return doc;
},