Skip to content

Commit 25f2363

Browse files
committed
fix
1 parent 55695db commit 25f2363

2 files changed

Lines changed: 5 additions & 8 deletions

File tree

src/Parser.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -405,11 +405,7 @@ export class Parser implements Callbacks {
405405

406406
if (impliesClose) {
407407
while (this.stack.length > 0 && impliesClose.has(this.stack[0])) {
408-
const element = this.stack.shift();
409-
if (element === undefined) {
410-
break;
411-
}
412-
this.cbs.onclosetag?.(element, true);
408+
this.popElement(true);
413409
}
414410
}
415411
if (!this.isVoidElement(name)) {
@@ -705,6 +701,7 @@ export class Parser implements Callbacks {
705701
this.tokenizer.reset();
706702
this.tagname = "";
707703
this.attribname = "";
704+
this.attribvalue = "";
708705
this.attribs = null;
709706
this.stack.length = 0;
710707
this.startIndex = 0;

src/Tokenizer.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ export default class Tokenizer {
207207
{
208208
xmlMode = false,
209209
decodeEntities = true,
210-
recognizeSelfClosing = false,
210+
recognizeSelfClosing = xmlMode,
211211
}: {
212212
xmlMode?: boolean;
213213
decodeEntities?: boolean;
@@ -513,7 +513,7 @@ export default class Tokenizer {
513513
this.startEntity();
514514
}
515515
} else if (this.fastForwardTo(CharCodes.Lt)) {
516-
// Outside of <title> tags, we can fast-forward.
516+
// Outside of RCDATA tags, we can fast-forward.
517517
this.sequenceIndex = 1;
518518
}
519519
} else {
@@ -627,7 +627,7 @@ export default class Tokenizer {
627627
this.cbs.onselfclosingtag(this.index);
628628
this.sectionStart = this.index + 1;
629629

630-
if (!(this.xmlMode || this.recognizeSelfClosing)) {
630+
if (!this.recognizeSelfClosing) {
631631
this.enterTagBody();
632632
return;
633633
}

0 commit comments

Comments
 (0)