-
-
Notifications
You must be signed in to change notification settings - Fork 708
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
fix(purify): fix _createIterator #850
Conversation
* Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document. | ||
* | ||
* @param {Document} root document/fragment to create iterator for | ||
* @return {Iterator} iterator instance | ||
* @param {Node} root The root element or node to start traversing on. | ||
* @return {NodeIterator} The created NodeIterator | ||
*/ | ||
const _createIterator = function (root) { | ||
const _createNodeIterator = function (root) { |
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.
https://github.com/microsoft/TypeScript/blob/main/src/lib/dom.generated.d.ts#L7160
I've modified the jsdoc
with reference to that documentation.
Also, the naming seems clearer for _createNodeIterator
than _createIterator
. (Returns a NodeIterator.)
What do you think of this fix? 🙏
false | ||
null |
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.
I removed that argument. ("false")
*/ | ||
const _basicCustomElementTest = function (tagName) { | ||
const _isBasicCustomElement = function (tagName) { |
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.
The function name in the jsdoc
was different from the actual function name, so I tried to modify it, and finally changed it to _isBasicCustomElement
with the is
prefix because it returns a boolean
.
jsdoc: _basicCustomElementCheck
actual: _basicCustomElementTest
This looks good me thinks, but let me do some manual testing - high risk change 😅 |
@cure53 Thanks!!! |
Summary
Hello 👋, @cure53
I was looking at the
_createIterator
function and realized it had an unnecessary argument (false
), so I did a fix-and-refactor.https://developer.mozilla.org/en-US/docs/Web/API/Document/createNodeIterator
https://dom.spec.whatwg.org/#dom-document-createnodeiterator
Even if you refer to the documentation above, the
createNodeIterator
function only requires 3 arguments:root
,whatToShow
, andfilter
.https://github.com/microsoft/TypeScript/blob/main/src/lib/dom.generated.d.ts#L7160
Tasks