isaacs / sax-js

A sax style parser for JS
Other
1.09k stars 325 forks source link

fix: don't throw on comment in dtd #267

Closed SethFalco closed 3 months ago

SethFalco commented 8 months ago

Makes the minimum change to allow comments in Doctype declarations, without adding additional support for parsing Doctype entities.

As sax was not checking for comments before, it would interpret ' or ] as XML and falsely treat them as real quotes or closing tags despite residing in an XML comment.

I don't think compatibility is a major concern for this PR, as the previous behavior was to throw an exception, so XML files that were affected by this weren't supported to begin with.

Regression Tests

I ran the regression test script from https://github.com/isaacs/sax-js/pull/266 on this PR, and can confirm it passes. 👍🏽

Related