Skip to content

Conversation

@super-dm3
Copy link
Contributor

@super-dm3 super-dm3 commented Nov 14, 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?

:nth-child(n+B) selects only B-th elements

What is the new behavior?

:nth-child(n+B) selects B-th and all following elements
See: https://developer.mozilla.org/en-US/docs/Web/CSS/:nth-child#nth-childn7

Does this introduce a breaking change?

  • Yes
  • No

Other information

  • This is an additional fix for PR #56.
    My previous PR didn't actually fix the nth-child(n+B) bug. Two duplicate functions exist 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.
    Ideally, there should be no duplicated logic. But it's a task for the future refactoring.
  • Also, there was an invalid test:
    ...
    // BROKEN RULES -- these should always fail to match.
    // 6n + 7;
    ...
    This rule is actually valid for 20 elements. Every 6th element with an offset of 7 should match 3 elements but not 0. Rewrote this test to 6n+30 to fail

@codecov
Copy link

codecov bot commented Nov 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.30%. Comparing base (5a9ddce) to head (f150006).
Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##               main      #60   +/-   ##
=========================================
  Coverage     89.30%   89.30%           
+ Complexity     1350     1349    -1     
=========================================
  Files            26       26           
  Lines          3131     3132    +1     
=========================================
+ Hits           2796     2797    +1     
  Misses          335      335           

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


🚨 Try these New Features:

@jakejackson1 jakejackson1 merged commit f150006 into GravityPDF:main Nov 19, 2024
12 checks passed
@jakejackson1
Copy link
Member

@super-dm3 thanks! Along with merging your changes, I went ahead and deprecated the duplicate parseAnB() method and swapped the calls over to Util::parseAnB() for consistency: 2da963a

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