8000 fix: restore more Node and ProcessingInstruction types by karfau · Pull Request #726 · xmldom/xmldom · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: restore more Node and ProcessingInstruction types #726

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

Merged
merged 7 commits into from
Sep 14, 2024

Conversation

karfau
Copy link
Member
@karfau karfau commented Sep 9, 2024
  • Node.nodeType
  • Node.textContent
  • Node.columnNumber
  • Node.lineNumber
  • ProcessingInstruction.data (inherited from CharacterData)
  • ProcessingInstruction.target

fixes #725

@karfau karfau requested a review from shunkica September 9, 2024 17:27
@karfau karfau added this to the 0.9.3 milestone Sep 9, 2024
@karfau karfau added the types Anything regarding Typescript label Sep 9, 2024
Copy link
codecov bot commented Sep 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.36%. Comparing base (60bbeb1) to head (9173375).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #726   +/-   ##
=======================================
  Coverage   94.36%   94.36%           
=======================================
  Files           8        8           
  Lines        2093     2094    +1     
  Branches      537      538    +1     
=======================================
+ Hits         1975     1976    +1     
  Misses        118      118           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@karfau karfau requested review from Ponynjaa and removed request for shunkica September 9, 2024 17:42
Copy link
Collaborator
@Ponynjaa Ponynjaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest some changes.

assert(fakeNode.nodeType, undefined);
assert(fakeNode.lineNumber, undefined);
assert(fakeNode.columnNumber, undefined);
assert(fakeNode.textContent, undefined);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't really make sense since no matter what property you try to access it's always gonna be undefined since fakeNode is just an empty object. You should probably just use an Element or something else that extends Node.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I mentioned in the comment above this section, yes, there is no actual instance of type Node, but these assertions should make sure that those properties are available on the type Node, not only on some sub type/class.
When using assert, the CodeQL checks will complain that the values are unused.
And yes, I'm asserting that the value is undefined, which only makes sense in the context of this assertion.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh I think I get it now... so basically if you would try to do this: assert(fakeNode.doesntExist, undefined) JS would be fine with it but since the TS compiler checks this the check would fail correctly.

@Ponynjaa
Copy link
Collaborator

Btw other than that it looks good to me and can be released. #728 is building on this branch ;)

@karfau
Copy link
Member Author
karfau commented Sep 14, 2024

@Ponynjaa thx for the review, I integrated your suggestions.
Are you able to approve the PR?

and avoid redundant uncheckable conditions
@karfau karfau changed the title fix: restore Node and ProcessingInstruction prop types fix: restore more Node and ProcessingInstruction types Sep 14, 2024
@karfau karfau enabled auto-merge (squash) September 14, 2024 18:59
Copy link
Collaborator
@Ponynjaa Ponynjaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me!

@karfau karfau disabled auto-merge September 14, 2024 20:37
@karfau karfau merged commit 7739150 into master Sep 14, 2024
38 checks passed
@karfau karfau deleted the missing-node-pi-types branch September 14, 2024 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
types Anything regarding Typescript
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing types for most properties
2 participants
0