Skip to content

:nth-* pseudo-classes interoperability #225

@nt1m

Description

@nt1m

Description

  1. Make sure the root element matches :nth-child/:nth-last-child/:nth-of-type/:nth-last-of-type accordingly (Blink/Gecko do this properly, WebKit does not)
  2. Support for of <selector-list> syntax for :nth-child/:nth-last-child (WebKit supports this)

Rationale

Interoperability issues for something that is very basic and commonly used by web developers.

Specification

https://w3c.github.io/csswg-drafts/selectors-4/#child-index

Tests

Tests for item 1:
css/selectors/child-indexed-no-parent.html
css/selectors/child-indexed-pseudo-class.html
css/selectors/selector-structural-pseudo-root.html

Tests for item 2:

css/selectors/nth-child-and-nth-last-child.html
css/selectors/nth-child-of-classname.html
css/selectors/nth-child-of-complex-selector.html
css/selectors/nth-child-of-compound-selector.html
css/selectors/nth-child-of-tagname.html
css/selectors/nth-child-specificity-1.html
css/selectors/nth-child-specificity-2.html
css/selectors/nth-child-specificity-3.html
css/selectors/nth-child-specificity-4.html
css/selectors/nth-last-child-of-classname.html
css/selectors/nth-last-child-of-complex-selector.html
css/selectors/nth-last-child-of-compound-selector.html
css/selectors/nth-last-child-of-style-sharing-1.html
css/selectors/nth-last-child-of-style-sharing-2.html
css/selectors/nth-last-child-of-tagname.html
css/selectors/nth-last-child-specificity-1.html
css/selectors/nth-last-child-specificity-2.html
css/selectors/nth-last-child-specificity-3.html
css/selectors/nth-last-child-specificity-4.html

Some WebKit layout tests I haven't got around to porting, that might be worth adding:

LayoutTests/fast/css/nth-last-child-of-style-update-optimization.html
LayoutTests/fast/selectors/nth-last-child-of-cannot-match-during-parsing-1.html
LayoutTests/fast/selectors/nth-last-child-of-cannot-match-during-parsing-2.html
LayoutTests/fast/selectors/nth-last-child-of-class-style-update.html
LayoutTests/fast/css/parsing-css-nth-child-of-1.html
LayoutTests/fast/css/parsing-css-nth-child-of-2.html
LayoutTests/fast/css/parsing-css-nth-child-of-3.html
LayoutTests/fast/css/parsing-css-nth-child-of-4.html
LayoutTests/fast/css/parsing-css-nth-child.html
LayoutTests/fast/css/parsing-css-nth-last-child-of-1.html
LayoutTests/fast/css/parsing-css-nth-last-child-of-2.html
LayoutTests/fast/css/parsing-css-nth-last-child-of-3.html
LayoutTests/fast/css/parsing-css-nth-last-child-of-4.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions