-
Notifications
You must be signed in to change notification settings - Fork 95
fix: locator is now true even when other options are being used for the DOMParser #803
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
Hi @karfau , I think it should always be true whenever this exact option isn't given, but I understand that this probably could be a breaking change now... What do you think? |
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.
Thank you for reporting and providing a fix.
I think the bug report and fix make sense.
We just need to change the expectation in the failing test.
lib/dom-parser.js
Outdated
function DOMParser(options) { | ||
options = options || { locator: true }; | ||
options = options || {}; | ||
if (typeof options.locator === 'undefined') { |
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.
How is this different from
if (typeof options.locator === 'undefined') { | |
if (options.locator === undefined) { |
?
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.
In this case it doesn't make any difference, so yeah I'll change that
Regarding the breaking change, I would say this was more an oversight. And the way the docs are describing it makes more sense. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #803 +/- ##
=======================================
Coverage 95.06% 95.06%
=======================================
Files 8 8
Lines 2167 2169 +2
Branches 570 571 +1
=======================================
+ Hits 2060 2062 +2
Misses 107 107 ☔ View full report in Codecov by Sentry. |
Fixed locator not being true by default when using any other options.
Closes #802