<commit_before># SelectorSet

An efficient data structure for matching and querying elements against a large set of CSS selectors.


## Usage

``` javascript
var set = new SelectorSet();
set.add('#logo');
set.add('.post');
set.add('h1');

var el = document.createElement('h1');
set.matches(el);
// => [ { selector: 'h1' } ]

document.body.appendChild(el);
set.queryAll(document.body);
// => [ { selector: 'h1': elements: [el] } ]
```


## Installation
<commit_msg>Add data usage example<commit_after># SelectorSet

An efficient data structure for matching and querying elements against a large set of CSS selectors.


## Usage

``` javascript
var set = new SelectorSet();
set.add('#logo');
set.add('.post');
set.add('h1');

var el = document.createElement('h1');
set.matches(el);
// => [ { selector: 'h1' } ]

document.body.appendChild(el);
set.queryAll(document.body);
// => [ { selector: 'h1': elements: [el] } ]
```

An arbitrary `data` object can be associated with each selector to help identify matches.

``` javascript
var set = new SelectorSet();

var data = function setupForm() {
}
set.add('form', data);

var el = document.createElement('form');
set.matches(el);
// => [ { selector: 'form', data: setupForm } ]
```


## Installation

{'fraction_non_alphanumeric': 0.17765273311897106, 'fraction_numerical': 0.006430868167202572, 'mean_word_length': 4.608108108108108, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '153860', 'n_tokens_mistral': 411, 'n_tokens_neox': 392, 'n_words': 116}