Skip to content
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 error when getting parents() for HTML elements #58

Closed
wants to merge 3 commits into from

Conversation

super-dm3
Copy link
Contributor

@super-dm3 super-dm3 commented Nov 7, 2024

Pull Request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no API changes)
  • Build-related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

  • Calling parents() on HTML elements throws error
  • Calling parent() on HTML root element throws error

What is the new behavior?

  • No errors when calling parents()
  • parent() on root element returns empty match

Does this introduce a breaking change?

  • Yes
  • No

Other information

Copy link

codecov bot commented Nov 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.28%. Comparing base (5a9ddce) to head (3aba5fd).
Report is 2 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main      #58      +/-   ##
============================================
- Coverage     89.30%   89.28%   -0.02%     
+ Complexity     1350     1349       -1     
============================================
  Files            26       26              
  Lines          3131     3127       -4     
============================================
- Hits           2796     2792       -4     
  Misses          335      335              

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

@super-dm3
Copy link
Contributor Author

It turns out that my previous PR #56 didn't actually fix the nth-child(n+B) bug. There are two duplicate functions for isNthChild() and parseAnB() logic. I fixed only one that passed the tests, but appearance doesn't affect the result. I didn't notice it last time. Commit https://github.com/GravityPDF/querypath/pull/58/commits/ebf16bc4fcb222004e494f00907525af6e137589 fixes a second pair of functions as well.
Ideally, there should be no duplicated logic. But it's a task for the future refactoring. Now, my main priority was fixing the bug.

@jakejackson1
Copy link
Member

@super-dm3 thanks again for the PR. Would you be able to split up the two unrelated bug fixes into separate pull requests? It'll make it much easier to review, test, and amend (if needed) the changes individually.

Much appreciated.

@super-dm3
Copy link
Contributor Author

@super-dm3 thanks again for the PR. Would you be able to split up the two unrelated bug fixes into separate pull requests? It'll make it much easier to review, test, and amend (if needed) the changes individually.

Much appreciated.

Sure, that was my initial intention. I did not expect that GitHub would automatically merge my second commit after I had already posted a PR. I'm new to all of these contribution mechanics 😅.
Just created two separate PRs. Will remove this one now.

@super-dm3 super-dm3 closed this Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants