You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
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
npmnpm
Version published
Weekly downloads
181K
7.03%
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

css

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