Skip to content

Commit f56058b

Browse files
committed
updated readme
1 parent 9878be0 commit f56058b

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

readme.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ a CSS selector parser
55
##Example
66

77
```js
8-
require("CSSwhat")("foo[bar]:baz")
8+
require('CSSwhat')('foo[bar]:baz')
99

1010
~> [ [ { type: 'tag', name: 'foo' },
1111
{ type: 'attribute',
@@ -20,14 +20,20 @@ require("CSSwhat")("foo[bar]:baz")
2020

2121
##API
2222

23-
__`CSSwhat(selector, options)` - Parses `str`, with the past `options`.__
23+
__`CSSwhat(selector, options)` - Parses `str`, with the passed `options`.__
2424

2525
The function returns a two-dimensional array. The first array represents subselects separated by commas (eg. `sub1, sub2`), the second contains the relevant tokens for that selector. Possible token types are:
2626

2727
name | attributes | example | output
2828
---- | ---------- | ------- | ------
2929
`tag`| `name` | `div` | `{ type: 'tag', name: 'div' }`
3030
`universal`| - | `*` | `{ type: 'universal' }`
31+
`pseudo`| `name`, `data`|`:name(data)`| `{ type: 'pseudo', name: 'name', data: 'data' }`
32+
`pseudo`| `name`, `data`|`:name`| `{ type: 'pseudo', name: 'name', data: null }`
33+
`attribute`|`name`, `action`, `value`, `ignoreCase`|`[attr]`|`{ type: 'attribute', name: 'attr', action: 'exists', value: '', ignoreCase: false }`
34+
`attribute`|`name`, `action`, `value`, `ignoreCase`|`[attr=val]`|`{ type: 'attribute', name: 'attr', action: 'equals', value: 'val', ignoreCase: false }`
35+
`attribute`|`name`, `action`, `value`, `ignoreCase`|`[attr^=val]`|`{ type: 'attribute', name: 'attr', action: 'start', value: 'val', ignoreCase: false }`
36+
`attribute`|`name`, `action`, `value`, `ignoreCase`|`[attr$=val]`|`{ type: 'attribute', name: 'attr', action: 'end', value: 'val', ignoreCase: false }`
3137

3238
//TODO complete list
3339

0 commit comments

Comments
 (0)