Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

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

Open
eoghanmurray wants to merge 1 commit into antonmedv:master
base: master
Choose a base branch
Loading
from eoghanmurray:nthOfType

Conversation

@eoghanmurray
Copy link

@eoghanmurray eoghanmurray commented May 4, 2023

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)

Copy link
Author

eoghanmurray commented May 4, 2023
edited
Loading

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

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /