bo-selector
v0.0.10
Published
CSS selector parser based on jison
Downloads
663,633
Readme
bo-selector
A CSS selector parser based on jison
Example
var parser = require('bo-selector').parser;
var ast = parser.parse('p:has(.foo), b');
console.log(require('util').inspect(ast, false, null));
Generates
{ type: 'selector_list',
selectors:
[ { type: 'selector',
element:
{ type: 'element',
name: 'p',
constraints:
[ { type: 'pseudo_func',
func:
{ type: 'function',
name: 'has',
body:
{ type: 'selector_list',
selectors:
[ { type: 'selector',
element:
{ type: 'element',
name: '*',
constraints: [ { type: 'class', name: 'foo' } ] } } ] } } } ] } },
{ type: 'selector',
element: { type: 'element', name: 'b', constraints: [] } } ] }
License
BSD