Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Set "isInTag" to `true`.
isInTag = true
while (offset++ < contents.length) {
// Stop parsing tag name on first white space or closing tag.
if (/\s|>/.test(contents[offset])) {
isInTag = contents[offset] !== '>'
if (tagname) {
if (isClosingTag) {
if (tags[tags.length - 1] === tagname) {
tags.pop()
}
} else {
if (!voidElements.hasOwnProperty(tagname)) {
tags.push(tagname)
}
}
}
break
}
tagname += contents[offset]
}
} else if (char === '>') {
isInTag = false
} else if (char === '&') {
for (var j = offset; j < contents.length; j++) {
if (WHITESPACE_REGEXP.test(contents[j])) {
break