{
  "name": "CSSselect",
  "version": "0.4.0",
  "description": "a CSS selector compiler/engine",
  "author": {
    "name": "Felix Boehm",
    "email": "me@feedic.com"
  },
  "keywords": [
    "css",
    "selector"
  ],
  "repository": {
    "type": "git",
    "url": "git://github.com/fb55/CSSselect.git"
  },
  "dependencies": {
    "CSSwhat": "0.4",
    "domutils": "1.3"
  },
  "devDependencies": {
    "htmlparser2": "*",
    "cheerio-soupselect": "*",
    "mocha": "*",
    "expect.js": "*"
  },
  "scripts": {
    "test": "mocha"
  },
  "license": "BSD-like",
  "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##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##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---\n\nLicense: BSD-like\n",
  "readmeFilename": "README.md",
  "bugs": {
    "url": "https://github.com/fb55/CSSselect/issues"
  },
  "homepage": "https://github.com/fb55/CSSselect",
  "_id": "CSSselect@0.4.0",
  "dist": {
    "shasum": "d3c60ec0edf55c2ef08516a7af81895bc5c7b3bf"
  },
  "_from": "CSSselect@~0.4.0",
  "_resolved": "https://registry.npmjs.org/CSSselect/-/CSSselect-0.4.0.tgz"
}
