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

Implement nth-of-type when we are including the tagName #71

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

eoghanmurray
Copy link

An implementation of nth-of-type #3

The idea here is to never allow the combination of a tagName + :nth-child — from the point of view that it's

  • much more intuitive for humans reading it
  • might be more robust
    (reasons given by @kfrederix)

@eoghanmurray
Copy link
Author

eoghanmurray commented May 4, 2023

Highlighting one unexpected change to the test results ... the following is preferred as the algo immediately cuts off if a unique match is found at a given level:

        ++.-of2·p:nth-child(2)·>·a                   (Expected)
        --.cell:nth-child(1)·>·p:nth-of-type(1)·>·a    (Actual)

Before, .cell:nth-child(1)·>·p:nth-child(2)·>·a is checked, but found to be non-unique, so algo continues exploring higher levels.

I don't know if it's desirable to fix this or not? And don't know how best to fix.

Note: up for debate, but the 'desired' selector would be .-of2 p:nth-of-type(1) > a which is unique

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.

None yet

1 participant