Skip to content

Files

Latest commit

 

History

History
66 lines (48 loc) · 1.14 KB

selector-anb-no-unmatchable.md

File metadata and controls

66 lines (48 loc) · 1.14 KB

Pattern: Unmatchable An+B selector

Issue: -

Description

Disallows unmatchable An+B selectors.

a:nth-child(0n+0) {}
/*↑             ↑
 * This unmatchable An+B selector */

An+B selectors are one-indexed. Selectors that always evaluate to 0 will not match any elements.

Examples

The following patterns are considered problems:

a:nth-child(0) {}
a:nth-last-child(0n) {}
a:nth-of-type(0n+0) {}
a:nth-last-of-type(0 of a) {}

The following patterns are not considered problems:

a:nth-child(1) {}
a:nth-last-child(1n) {}
a:nth-of-type(1n+0) {}
a:nth-last-of-type(1 of a) {}

Further Reading