-
-
Notifications
You must be signed in to change notification settings - Fork 325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Entity declarations with XML elements or other entities #260
Conversation
This is a great thing to support, and I'm frankly amazed at how small the code change is. I'm wondering if it's a patch or breaking change, if anyone is depending on the incorrect behavior, since this library is so old and has been mostly untouched for so long. Also, I have a few ideas of some cases that might surface some edge cases, but I wouldn't be surprised if just works as it is. I'll poke at it tonight, thanks! |
To avoid a breaking change, the new behavior could be made conditional on a setting during sax instantiation:
|
PR-URL: #260 Credit: @HeikoTheissen Close: #260 Reviewed-by: @isaacs
Thanks for merging this and updating https://www.npmjs.com/package/sax ! Do you also plan to mention the new option |
Hey hey! Sorry to pester, just noting that this implementation actually has a bug that renders the new option unusable in many cases. In SVGO, it's preventing us from migrating from our (unmaintained) fork of sax back to upstream. I've already opened a pull request that explains and resolves the issue, includes tests, and I also checked by parsing the conformance tests for XML to ensure no exceptions occur. Before, with the option enabled, the conformance test suite threw an exception. Would really appreciate it if others could take a peek when they have time. I've also fixed a few other bugs impacting us in separate pull requests btw. |
Issue 1
Entity declarations that involve XML elements, like in
wrongly contribute a text node, which leads to
whereas they should contribute XML elements and lead to
Without the patch to
lib/sax.js
, the new test casetest/entity-elem.js
fails withWith the patch, it passes.
Issue 2
Entity declarations that involve other entities, like in
are completely resolved, leading to
instead of
Without the patch to
lib/sax.js
, the new test casetest/entity-recursive.js
fails withWith the patch, it passes.