|
|
@ -134,16 +134,12 @@ export default function tag(parser: Parser) {
|
|
|
|
// close any elements that don't have their own closing tags, e.g. <div><p></div>
|
|
|
|
// close any elements that don't have their own closing tags, e.g. <div><p></div>
|
|
|
|
while (parent.name !== name) {
|
|
|
|
while (parent.name !== name) {
|
|
|
|
if (parent.type !== 'Element') {
|
|
|
|
if (parent.type !== 'Element') {
|
|
|
|
if (parser.last_auto_closed_tag && parser.last_auto_closed_tag.tag === name) {
|
|
|
|
const message = parser.last_auto_closed_tag && parser.last_auto_closed_tag.tag === name
|
|
|
|
|
|
|
|
? `</${name}> attempted to close <${name}> that was already automatically closed by <${parser.last_auto_closed_tag.reason}>`
|
|
|
|
|
|
|
|
: `</${name}> attempted to close an element that was not open`;
|
|
|
|
parser.error({
|
|
|
|
parser.error({
|
|
|
|
code: `invalid-closing-tag`,
|
|
|
|
code: `invalid-closing-tag`,
|
|
|
|
message: `<${parser.last_auto_closed_tag.tag}> cannot have child element <${parser.last_auto_closed_tag.reason}>`,
|
|
|
|
message
|
|
|
|
}, start);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
parser.error({
|
|
|
|
|
|
|
|
code: `invalid-closing-tag`,
|
|
|
|
|
|
|
|
message: `</${name}> attempted to close an element that was not open`
|
|
|
|
|
|
|
|
}, start);
|
|
|
|
}, start);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|