Socket
Socket
Sign inDemoInstall

bo-selector

Package Overview
Dependencies
0
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    bo-selector

CSS selector parser based on jison


Version published
Weekly downloads
135K
decreased by-0.1%
Maintainers
1
Install size
54.4 kB
Created
Weekly downloads
 

Readme

Source

bo-selector

A CSS selector parser based on jison

Build Status

Example

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:

{ 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

License

BSD

Keywords

FAQs

Last updated on 02 Jan 2014

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc