0.0.9 • Published 2 years ago

csset v0.0.9

Weekly downloads
4
License
MIT
Repository
github
Last release
2 years ago

csset

Set operations for CSS selectors

GitHub license Issues Build Status Coverage Status Code Size Weekly downloads

Install

npm install --save csset

Requirements

Works in all modern browsers :)

Usage

Basic

import { Csset } from 'csset';

// Create your sets
const set1 = new Csset('div > p');
const set2 = new Csset('div');
const set3 = new Csset('p');

// Make set operations
// supersetOf
console.assert(set1.supersetOf(set2) === false);
console.assert(set2.supersetOf(set1) === false);
console.assert(set3.supersetOf(set1) === true);

// subsetOf
console.assert(set1.subsetOf(set3) === true);
console.assert(set1.subsetOf(set2) === false);

// union
console.assert(set1.union(set3).toString() === 'p');
console.assert(set1.union(set2).toString() === 'div > p, div');

// intersection
console.assert(set1.intersection(set3).toString() === 'div > p');
console.assert(set1.intersection(set2) === undefined); // void means empty set

Known issues & limitations

  • As for now pseudo selectors are not supported

Roadmap

  • Add better support for complex CSS selectors using parsel-ts package
  • consider other set operations (diff, complementary, ...)

Release notes

0.0.9

  • Added build for ESM modules
0.0.9

2 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago