Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bo-selector

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bo-selector

CSS selector parser based on jison

  • 0.0.10
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
178K
increased by3.46%
Maintainers
1
Weekly downloads
 
Created
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

Package last updated on 02 Jan 2014

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc