in JSDOMParser.js [1018:1069]
makeElementNode(retPair) {
var c = this.nextChar();
// Read the Element tag name
var strBuf = this.strBuf;
strBuf.length = 0;
while (!whitespace.includes(c) && c !== ">" && c !== "/") {
if (c === undefined) {
return false;
}
strBuf.push(c);
c = this.nextChar();
}
var tag = strBuf.join("");
if (!tag) {
return false;
}
var node = new Element(tag);
// Read Element attributes
while (c !== "/" && c !== ">") {
if (c === undefined) {
return false;
}
while (whitespace.includes(this.html[this.currentChar++])) {
// Advance cursor to first non-whitespace char.
}
this.currentChar--;
c = this.nextChar();
if (c !== "/" && c !== ">") {
--this.currentChar;
this.readAttribute(node);
}
}
// If this is a self-closing tag, read '/>'
var closed = false;
if (c === "/") {
closed = true;
c = this.nextChar();
if (c !== ">") {
this.error("expected '>' to close " + tag);
return false;
}
}
retPair[0] = node;
retPair[1] = closed;
return true;
},