{
  "_from": "CSSselect@~0.4.0",
  "_id": "CSSselect@0.4.1",
  "_location": "/keybase/cheerio/CSSselect",
  "_phantomChildren": {},
  "_requiredBy": [
    "/keybase/cheerio"
  ],
  "_shrinkwrap": null,
  "author": {
    "email": "me@feedic.com",
    "name": "Felix Boehm"
  },
  "bugs": {
    "url": "https://github.com/fb55/CSSselect/issues"
  },
  "dependencies": {
    "CSSwhat": "0.4",
    "domutils": "1.4"
  },
  "description": "a CSS selector compiler/engine",
  "devDependencies": {
    "cheerio-soupselect": "*",
    "expect.js": "*",
    "htmlparser2": "*",
    "mocha": "*"
  },
  "homepage": "https://github.com/fb55/CSSselect",
  "keywords": [
    "css",
    "selector"
  ],
  "license": "BSD-like",
  "name": "CSSselect",
  "optionalDependencies": {},
  "readme": "#CSSselect [![Build Status](https://secure.travis-ci.org/fb55/CSSselect.png?branch=master)](http://travis-ci.org/fb55/CSSselect)\n\na CSS selector compiler/engine\n\n##What?\n\nCSSselect turns CSS selectors into functions that tests if elements match them. When searching for elements, testing is executed \"from the top\", similar to how browsers execute CSS selectors.\n\nIn its default configuration, CSSselect queries the DOM structure of the [`domhandler`](https://github.com/fb55/domhandler) module.\n\n##API\n\n```js\nvar CSSselect = require(\"CSSselect\");\n```\n\n####`CSSselect(query, elems)`\n\n- `query` can be either a function or a string. If it's a string, the string is compiled as a CSS selector.\n- `elems` can be either an array of elements, or a single element. If it is an element, its children will be used (so we're working with an array again).\n\nQueries `elems`, returns an array containing all matches.\n\nAliases: `CSSselect.selectAll(query, elems)`, `CSSselect.iterate(query, elems)`.\n\n####`CSSselect.compile(query)`\n\nCompiles the query, returns the function.\n\n####`CSSselect.is(elem, query)`\n\nTests whether or not an element is matched by `query`. `query` can be either a CSS selector or a function.\n\n####`CSSselect.selectOne(query, elems)`\n\nArguments are the same as for `CSSselect(query, elems)`. Only returns the first match, or `null` if there was no match.\n\n##Why?\n\nThe common approach of executing CSS selectors (used eg. by [`Sizzle`](https://github.com/jquery/sizzle), [`nwmatcher`](https://github.com/dperini/nwmatcher/) and [`qwery`](https://github.com/ded/qwery)) is to execute every component of the selector in order, from left to right. The selector `a b` for example will first look for `a` elements, then search these for `b` elements.\n\nWhile this works, it has some downsides: Children of `a`s will be checked multiple times, first, to check if they are also `a`s, then, for every superior `a` once, if they are `b`s. Using [Big O notation](http://en.wikipedia.org/wiki/Big_O_notation), that would be `O(n^2)`.\n\nThe far more efficient approach is to first look for `b` elements, then check if they have superior `a` elements: Using big O notation again, that would be `O(n)`.\n\nAnd that's exactly what CSSselect does.\n\n##How?\n\nBy stacking functions!\n\n_//TODO: Better explanation. For now, if you're interested, have a look at the source code._\n\n\n---\n\nLicense: BSD-like",
  "readmeFilename": "README.md",
  "repository": {
    "type": "git",
    "url": "git://github.com/fb55/CSSselect.git"
  },
  "scripts": {
    "test": "mocha"
  },
  "version": "0.4.1"
}
