-
Notifications
You must be signed in to change notification settings - Fork 92
fix(types): DOMParser.parseFromString requires mimeType as second argument #713
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OMG, thx
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #713 +/- ##
=======================================
Coverage 94.26% 94.26%
=======================================
Files 8 8
Lines 2094 2094
Branches 537 537
=======================================
Hits 1974 1974
Misses 120 120 ☔ View full report in Codecov by Sentry. |
I will file a release within the next few days. |
@krystofwoldrich FYI: it will still take some time, since I want to avoid a ton of releases with just type fixes, so I'm working on #717 right now, which will fix all currently known type issues. As part of that I also widened the accepted type to a literal type | string, just in case somebody only has that as a type for the mimeType to pass. |
Would be really nice to get a new release out soon, as the latest version throws an error when you don't supply the |
@papandreou this is intentional breaking change in version 0.9.0 which aligns the behavior of xmldom with the specs. This is not going to be "fixed", since it works as expected. The issue described here, is that this change is not reflected in the types of 0.9.0, which will be fixed along with all other type issues as part of the PR linked in my previous comment. for further discussion on this topic I would prefer to have it in the release discussion #435 |
Ah, apologies, I thought it was the other way around 🙈 |
hmmm... side note - should such changes be in major releases? |
In 0.* (aka unstable) versions, breaking changes are happening in minor versions. |
Based on the spec and the current implementation the second argument of DOMParser.parseFromString is not optional and doesn't have a default value.
xmldom/lib/dom-parser.js
Line 215 in 9f9a748
https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString
https://html.spec.whatwg.org/#dom-domparser-parsefromstring-dev
This fixes types for changes made in https://github.com/xmldom/xmldom/releases/tag/0.9.0
Previous release https://github.com/xmldom/xmldom/releases/tag/0.8.10 allowed
mimeType
as optional.