Bug 249990

Summary: Selector argument for :nth-of-type or :nth-last-of-type should be rejected
Product: WebKit Reporter: Tim Nguyen (:ntim) <ntim>
Component: CSSAssignee: Tim Nguyen (:ntim) <ntim>
Status: RESOLVED FIXED    
Severity: Normal CC: webkit-bug-importer
Priority: P2 Keywords: BrowserCompat, InRadar, WPTImpact
Version: Safari Technology Preview   
Hardware: Unspecified   
OS: Unspecified   

Description Tim Nguyen (:ntim) 2023-01-01 20:29:34 PST
Apparently :nth-of-type(n of S) parses and also has associated matching logic. Ditto for :nth-last-of-type().

https://github.com/web-platform-tests/wpt/blob/add22a2f6c1f9efcc1eccc66b3e9ea9e8045a4b5/css/selectors/nth-of-007.html

The spec says it should not be supported: https://w3c.github.io/csswg-drafts/selectors/#nth-of-type-pseudo
Comment 1 Radar WebKit Bug Importer 2023-01-01 20:30:11 PST
<rdar://problem/103805150>
Comment 2 Tim Nguyen (:ntim) 2023-01-01 21:19:02 PST
This WPT now covers it: css/selectors/nth-of-invalid.html
Comment 3 Tim Nguyen (:ntim) 2023-01-02 22:53:14 PST
Pull request: https://github.com/WebKit/WebKit/pull/8140
Comment 4 EWS 2023-01-03 09:48:22 PST
Committed 258389@main (008a2e643a90): <https://commits.webkit.org/258389@main>

Reviewed commits have been landed. Closing PR #8140 and removing active labels.