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 #61

Merged
merged 1 commit into from
Nov 19, 2024

Conversation

super-dm3
Copy link
Contributor

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

Also, parent() and parent() logic were merged to getParentElements() to avoid duplication of code/logic. This is an optional suggestion. The primary fix is only one additional check in both these functions: "while ($m->parentNode && ..."

Copy link

codecov bot commented Nov 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.34%. Comparing base (f150006) to head (88db7da).
Report is 4 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main      #61      +/-   ##
============================================
+ Coverage     89.30%   89.34%   +0.04%     
+ Complexity     1349     1340       -9     
============================================
  Files            26       26              
  Lines          3132     3003     -129     
============================================
- Hits           2797     2683     -114     
+ Misses          335      320      -15     

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


🚨 Try these New Features:

Copy link
Member

@jakejackson1 jakejackson1 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. While testing I found a separate bug #62, but it looks related to the is() functionality and will handle separately.

@jakejackson1 jakejackson1 merged commit 0cdb852 into GravityPDF:main Nov 19, 2024
12 checks passed
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