summaryrefslogtreecommitdiff
path: root/node_modules/doiuse/data/features/css-nth-child-of.js
blob: b1249f6fc7e3ed88900107d31f46c0c5ecaddf07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
/**
 * The newest versions of `:nth-child()` and `:nth-last-child()` accept an optional `of S` clause which filters the children to only those which match the selector list `S`. For example, `:nth-child(1 of .foo)` selects the first child among the children that have the `foo` class (ignoring any non-`foo` children which precede that child). Similar to `:nth-of-type`, but for arbitrary selectors instead of only type selectors.
 * @see https://caniuse.com/css-nth-child-of
 */

import { checkSelector } from '../../utils/util.js';

/**
 * @type {import('../features').Feature}
 */
export default checkSelector(
  (selector) => /:nth-(child|last-child)\(\s*\d+\s*of/.test(selector),
);