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
&
parsing wrong when xmlns
points to XHTML
#203
Comments
@colourful-land Thx for reporting this, providing a test scenario and linking all related issues.
|
I first tried 0.5.0 - failing the test, I tried again with the master branch from github, still fails.
Yes, as it is the case if the code runs in a browser using the browser's dom parser. |
Before starting to work on fixing xmldom#203, where namespaces and mime types are going to be used in multiple places, I decided to gather them in a separate module. **conventions.js** - `freeze`: is a small wrapper around `Object.freeze`, that gives type hints and also "works" if Object.freeze should not be available at runtime - `MIME_TYPE`: has all mime types that are supported by `DOMParser.parseFromString` (second argument) - `MIME_TYPE.isHTML`: short way to check if a mime type is the only one that enables HTML parsing - `NAMESPACE`: has all namespaces that we are currently using in the code base - `NAMESPACE.isHTML`: to check if a given value is the XHTML namespace **entities.js** - deprecated `entityMap` (but it's still available as an alias to `HTML_ENTITIES`) - `HTML_ENTITIES`: new name for `entityMap`, is now immutable - `XML_ENTITIES`: immutable map for the predefined XML entities
Before starting to work on fixing xmldom#203, where namespaces and mime types are going to be used in multiple places, I decided to gather them in a separate module. **conventions.js** - `freeze`: is a small wrapper around `Object.freeze`, that gives type hints and also "works" if `Object.freeze` should not be available at runtime - `MIME_TYPE`: has all mime types that are supported by `DOMParser.parseFromString` (second argument) - `MIME_TYPE.isHTML`: short way to check if a mime type is the only one that enables HTML parsing - `NAMESPACE`: has all namespaces that we are currently using in the code base - `NAMESPACE.isHTML`: to check if a given value is the XHTML namespace **entities.js** - deprecated `entityMap` (but it's still available as an alias to `HTML_ENTITIES`) - `HTML_ENTITIES`: new name for `entityMap`, is now immutable - `XML_ENTITIES`: immutable map for the predefined XML entities
FYI: I have a rough plan how to fix this issue (I already invested quite some time into a draft so far), but it's not a trivial one, and it's a breaking change. The main issue is that xmldom currently "detects" the default HTML namespace when parsing and applies certain rules, that should only be applied when setting the second argument Since there will be quite some changes and quite some missing tests for the areas of code that I need to touch, I will file multiple PRs before we can resolve this issue. |
Thank you very much @karfau. Right now I simply replace all occurrences of xhtml namespace in lib/sax.js and lib/dom.js to keep my project going. Hope to see a new release so I can rever to use unmodified xmldom in the near future! |
@colourful-land Interesting idea. I hope it helps more than it does any damage. Maybe you run the tests to see what things change/break. Just to be sure this doesn't introduce any serious bugs. Let m know in case any support is needed. I'm also looking forward to the next release(s), but can not promise any timeline. 😄 |
I needed to shift this into the next breaking release. I already invested quite some time into it, but it's not done and I don't want to hold back 0.8.0 any longer, which already has other potentially breaking changes (and mixing up to many of them is also not so nice for people doing updates). |
Great news: The version I have in #338 no longer has the issue you describe. It still is quite a massive change, so it will still need some time to get the PR done. With all the breaking changes I think I will try to create a pre-release, so you (and others can test it before we release it as 0.9.0 |
@weiwu-zhang I finally managed to merge and release the PR before it managed to be alive for a whole year. THank you fro your endurance and let me know in case you find any issues. |
Where both messages should be the same. Something trigged the misintrepreation when
xmlns="http://www.w3.org/1999/xhtml"
presents.P.S. this is not a duplicate of #58
The text was updated successfully, but these errors were encountered: