fix(parser): make reset() safe inside callbacks
FB
19d ago+34+34+01234567890123456789-3-3-0123456789
Two fixes for reset() being called from inside a callback:
count chunks before invoking tokenizer callbacks:writeIndexis incremented before the tokenizer runs, so areset()from a callback does not leave the chunk count one behind.stop closing a stack reset by a callback: the implied-close loop inonclosetagis bounded by the matched element's position, so areset()from anonclosetagcallback ends the loop instead of closing elements of the new document.
🤖 Generated with Claude Code
Summary by CodeRabbit
- Bug Fixes
- Fixed parser behavior when parsing is reset from a callback. Text queued after a reset is delivered in order, including when parsing pauses and resumes. Resetting during a closing-tag callback now stops additional closing-tag callbacks for the current input, preventing callbacks from continuing after parsing has been reset.