0.0.3 • Published 2 years ago

intersect-selectors v0.0.3

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

intersect-selectors

Finds the most optimized intersection of any number of CSS Selectors.

Usage

The function exported returns a string for the selector or an empty string if there is no intersection.

const intersectSelectors = require('intersect-selectors');

intersectSelectors(
  'a + b:nth-child(4) > b',
  'b, c',
  "b:not([attr~='yo']) > b",
  'b',
  'd b'
);

// Result: d a ~ b:nth-child(4):not([attr~='yo']) > b

NOTE: This program assumes that the CSS given matches the specification