diff --git a/src/Tokenizer.spec.ts b/src/Tokenizer.spec.ts index e596b976..68cc1c7e 100644 --- a/src/Tokenizer.spec.ts +++ b/src/Tokenizer.spec.ts @@ -222,6 +222,21 @@ describe("Tokenizer", () => { expect(tokenize("")).toMatchSnapshot(); }); + it.each(["a { + for (let split = 0; split <= input.length; split++) { + expect( + tokenize((tokenizer) => { + tokenizer.write(input.slice(0, split)); + tokenizer.write(input.slice(split)); + tokenizer.end(); + }).filter(([event]) => event === "ontext"), + ).toEqual([["ontext", 0, 1]]); + } + }, + ); + it("should treat as a declaration", () => { expect(tokenize("")).toMatchSnapshot(); }); diff --git a/src/Tokenizer.ts b/src/Tokenizer.ts index 6f983e1b..20ecb76c 100644 --- a/src/Tokenizer.ts +++ b/src/Tokenizer.ts @@ -1114,7 +1114,9 @@ export default class Tokenizer { case State.InAttributeValueSq: case State.InAttributeValueDq: case State.InAttributeValueNq: - case State.InClosingTagName: { + case State.InSelfClosingTag: + case State.InClosingTagName: + case State.AfterClosingTagName: { /* * If we are currently in an opening or closing tag, us not calling the * respective callback signals that the tag should be ignored.