# bo-selector

> CSS selector parser based on jison

Latest version **0.0.10** (published 2014-01-02) · BSD license · 0 weekly downloads

## Install

```sh
npm install bo-selector
pnpm add bo-selector
yarn add bo-selector
bun add bo-selector
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.10 |
| Published | 2014-01-02 |
| First published | 2013-12-29 |
| Weekly downloads | 0 |
| License | BSD |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Josh Chisholm |
| Maintainers | joshski |
| Keywords | css, selector, parser, jison, shamone |

## Links

- npm: https://www.npmjs.com/package/bo-selector
- Repository: https://github.com/featurist/bo-selector
- Issues: https://github.com/featurist/bo-selector/issues
- npm.io page: https://npm.io/package/bo-selector

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 0.0.10 (latest) — 2014-01-02
- 0.0.9 — 2014-01-02
- 0.0.8 — 2014-01-02
- 0.0.7 — 2014-01-01
- 0.0.6 — 2013-12-31
- 0.0.5 — 2013-12-30
- 0.0.4 — 2013-12-30
- 0.0.3 — 2013-12-30
- 0.0.2 — 2013-12-29
- 0.0.1 — 2013-12-29

## README

# bo-selector

A CSS selector parser based on [jison](http://zaach.github.io/jison/)

[![Build Status](https://secure.travis-ci.org/featurist/bo-selector.png?branch=master)](http://travis-ci.org/featurist/bo-selector)

### Example

```js
var parser = require('./bo-selector').parser;
var ast = parser.parse(".a[b = c], c[d]:e:f(g *:h:i[j]:k), :l > m[n ~= 'o']");
console.log(require('util').inspect(ast, false, null));
```

...generates:

```js
{ type: 'selector_list',
  selectors:
   [ { type: 'constraint_list',
       constraints:
        [ { type: 'class', name: 'a' },
          { type: 'attribute_equals', name: 'b', value: 'c' } ] },
     { type: 'element',
       name: 'c',
       constraints:
        [ { type: 'has_attribute', name: 'd' },
          { type: 'pseudo_class', name: 'e' },
          { type: 'pseudo_func',
            func:
             { type: 'function',
               name: 'f',
               args:
                { type: 'selector_list',
                  selectors:
                   [ { type: 'combinator_selector',
                       left: { type: 'element', name: 'g', constraints: [] },
                       right:
                        { type: 'element',
                          name: '*',
                          constraints:
                           [ { type: 'pseudo_class', name: 'h' },
                             { type: 'pseudo_class', name: 'i' },
                             { type: 'has_attribute', name: 'j' },
                             { type: 'pseudo_class', name: 'k' } ] },
                       combinator: 'descendant' } ] } } } ] },
     { type: 'combinator_selector',
       left:
        { type: 'constraint_list',
          constraints: [ { type: 'pseudo_class', name: 'l' } ] },
       right:
        { type: 'element',
          name: 'm',
          constraints: [ { type: 'attribute_contains_word', name: 'n', value: 'o' } ] },
       combinator: 'child' } ] }
```

### Bo?

[Craig David - Bo' Selecta Ruined My Life](http://www.youtube.com/watch?v=gpOA8AMZG8M)

### License

BSD

---
_Source: https://npm.io/package/bo-selector · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
