{"_id":"selector-lite","_rev":"323998","name":"selector-lite","description":"A small pure-JavaScript CSS selector engine","dist-tags":{"latest":"20.2.0"},"maintainers":[{"name":"lauriro","email":"lauri@rooden.ee"}],"time":{"modified":"2021-08-04T03:28:56.000Z","created":"2015-02-19T21:10:49.802Z","0.1.1":"2015-05-10T18:40:39.499Z","0.1.0":"2015-02-19T21:10:49.802Z","20.2.0":"2020-02-05T09:29:56.884Z","19.11.0":"2019-11-28T13:34:14.099Z"},"users":{},"author":{"name":"Lauri Rooden","email":"lauri@rooden.ee"},"repository":{"type":"git","url":"git://github.com/litejs/selector-lite.git"},"versions":{"0.1.1":{"name":"selector-lite","version":"0.1.1","stability":2,"license":"MIT","author":{"name":"Lauri Rooden","email":"lauri@rooden.ee"},"description":"A small pure-JavaScript CSS selector engine","keywords":["browser","css","selector","matches","closest","litejs"],"main":"selector.js","scripts":{"build":"node node_modules/buildman/index.js --all","travis-test":"istanbul cover ./tests/index.js && (coveralls < coverage/lcov.info || exit 0)","cover-climate":"istanbul cover ./tests/index.js && (codeclimate < coverage/lcov.info || exit 0)","test":"faucet; jshint --verbose selector.js"},"repository":{"type":"git","url":"git://github.com/litejs/selector-lite.git"},"bugs":{"url":"https://github.com/litejs/selector-lite/issues"},"devDependencies":{"buildman":"*","tape":"2.12.x"},"buildman":{"dist/selector-min.js":{"banner":"/*! litejs.com/MIT-LICENSE.txt */","input":"selector.js"}},"jshintConfig":{"asi":true,"laxcomma":true,"maxdepth":6,"quotmark":"double","-W030":false},"gitHead":"56994934f1192d975a1ec43f080e6cd9aec7e97e","homepage":"https://github.com/litejs/selector-lite#readme","_id":"selector-lite@0.1.1","_shasum":"cb16aefeae9fe29cad7afe28f04f5d9255cb9211","_from":".","_npmVersion":"2.8.3","_nodeVersion":"0.12.2","_npmUser":{"name":"lauriro","email":"lauri@rooden.ee"},"maintainers":[{"name":"lauriro","email":"lauri@rooden.ee"}],"dist":{"shasum":"cb16aefeae9fe29cad7afe28f04f5d9255cb9211","size":8721,"noattachment":false,"key":"/selector-lite/-/selector-lite-0.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/selector-lite/download/selector-lite-0.1.1.tgz"},"directories":{},"publish_time":1431283239499,"_cnpm_publish_time":1431283239499,"_hasShrinkwrap":false},"0.1.0":{"name":"selector-lite","version":"0.1.0","stability":2,"license":"MIT","author":{"name":"Lauri Rooden","email":"lauri@rooden.ee"},"description":"A small pure-JavaScript CSS selector engine","keywords":["browser","css","selector","matches","closest","litejs"],"main":"selector.js","scripts":{"build":"node node_modules/buildman/index.js --all"},"repository":{"type":"git","url":"git://github.com/litejs/selector-lite.git"},"bugs":{"url":"https://github.com/litejs/selector-lite/issues"},"devDependencies":{"buildman":"*"},"buildman":{"dist/selector-min.js":"selector.js"},"jshintConfig":{"asi":true,"laxcomma":true,"maxdepth":6,"quotmark":"double"},"gitHead":"bf04fe20d7598dbdeb5cfab5abf83233ed250fbd","homepage":"https://github.com/litejs/selector-lite","_id":"selector-lite@0.1.0","_shasum":"91bab4cc25bfac1ba4116d4bd2547c1ca8942c35","_from":".","_npmVersion":"2.5.0","_nodeVersion":"0.10.36","_npmUser":{"name":"lauriro","email":"lauri@rooden.ee"},"maintainers":[{"name":"lauriro","email":"lauri@rooden.ee"}],"dist":{"shasum":"91bab4cc25bfac1ba4116d4bd2547c1ca8942c35","size":5178,"noattachment":false,"key":"/selector-lite/-/selector-lite-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/selector-lite/download/selector-lite-0.1.0.tgz"},"directories":{},"publish_time":1424380249802,"_cnpm_publish_time":1424380249802,"_hasShrinkwrap":false},"20.2.0":{"name":"selector-lite","version":"20.2.0","license":"MIT","author":{"name":"Lauri Rooden","email":"lauri@rooden.ee"},"description":"A small pure-JavaScript CSS selector engine","keywords":["browser","css","selector","matches","closest","litejs"],"main":"selector.js","repository":{"type":"git","url":"git://github.com/litejs/selector-lite.git"},"bugs":{"url":"https://github.com/litejs/selector-lite/issues"},"jshintConfig":{"asi":true,"laxcomma":true,"maxdepth":6,"quotmark":"double","-W030":false},"litejs":{"build":["-r selector.js"]},"gitHead":"30aff3a9fffdd8b32b5711c66cf096556977f26d","homepage":"https://github.com/litejs/selector-lite#readme","_id":"selector-lite@20.2.0","_nodeVersion":"8.16.2","_npmVersion":"6.9.0","dist":{"shasum":"86fc2c5d9fd6e8c7b42384302241deedd4b9e610","size":3333,"noattachment":false,"key":"/selector-lite/-/selector-lite-20.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/selector-lite/download/selector-lite-20.2.0.tgz"},"maintainers":[{"name":"lauriro","email":"lauri@rooden.ee"}],"_npmUser":{"name":"lauriro","email":"lauri@rooden.ee"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/selector-lite_20.2.0_1580894996736_0.8353004789398235"},"_hasShrinkwrap":false,"publish_time":1580894996884,"_cnpm_publish_time":1580894996884},"19.11.0":{"name":"selector-lite","version":"19.11.0","license":"MIT","author":{"name":"Lauri Rooden","email":"lauri@rooden.ee"},"description":"A small pure-JavaScript CSS selector engine","keywords":["browser","css","selector","matches","closest","litejs"],"main":"selector.js","repository":{"type":"git","url":"git://github.com/litejs/selector-lite.git"},"bugs":{"url":"https://github.com/litejs/selector-lite/issues"},"jshintConfig":{"asi":true,"laxcomma":true,"maxdepth":6,"quotmark":"double","-W030":false},"litejs":{"build":["-r selector.js"]},"gitHead":"083d47b22f0adf39dd5eff0915538548b5e839f3","homepage":"https://github.com/litejs/selector-lite#readme","_id":"selector-lite@19.11.0","_nodeVersion":"8.16.2","_npmVersion":"6.9.0","dist":{"shasum":"476aae4d990deb515c075f8a1a9050f60746abdb","size":3307,"noattachment":false,"key":"/selector-lite/-/selector-lite-19.11.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/selector-lite/download/selector-lite-19.11.0.tgz"},"maintainers":[{"name":"lauriro","email":"lauri@rooden.ee"}],"_npmUser":{"name":"lauriro","email":"lauri@rooden.ee"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/selector-lite_19.11.0_1574948053965_0.6322854775983244"},"_hasShrinkwrap":false,"publish_time":1574948054099,"_cnpm_publish_time":1574948054099}},"readme":"[1]: https://badgen.net/travis/litejs/selector-lite\n[2]: https://travis-ci.org/litejs/selector-lite\n[3]: https://badgen.net/coveralls/c/github/litejs/selector-lite\n[4]: https://coveralls.io/r/litejs/selector-lite\n[5]: https://badgen.net/packagephobia/install/selector-lite@19.11.0\n[6]: https://packagephobia.now.sh/result?p=selector-lite\n[7]: https://badgen.net/badge/icon/Buy%20Me%20A%20Tea/orange?icon=kofi&label\n[8]: https://www.buymeacoffee.com/lauriro\n\n\nSelector lite &ndash; [![Build][1]][2] [![Coverage][3]][4] [![Size][5]][6] [![Buy Me A Tea][7]][8]\n=============\n\nA small pure-JavaScript CSS selector engine.\n\n - no library dependencies\n - CSS 3 Selector support\n - only 2KB minified and 1KB gzipped\n\nExamples\n--------\n\n```javascript\nvar selector = require(\"selector-lite\")\n\n// Can be used to implement browser built-in functions.\n\nfunction getElementById(id) {\n    return selector.find(this, \"#\" + id, true)\n}\nfunction getElementsByTagName(tag) {\n    return selector.find(this, tag)\n}\nfunction getElementsByClassName(sel) {\n    return selector.find(this, \".\" + sel.replace(/\\s+/g, \".\"))\n}\nfunction querySelector(sel) {\n    return selector.find(this, sel, true)\n}\nfunction querySelectorAll(sel) {\n    return selector.find(this, sel)\n}\n```\n\nMethods\n-------\n\n - selector.`find(node, selector, returnFirstMatch)` - Find matching elements like querySelector.\n - selector.`matches(node, selector)` - Returns a Boolean indicating whether or not\n   the element would be selected by the specified selector string.\n - selector.`closest(selector)` - Returns the Element, descendant of this element\n   (or this element itself), that is the closest ancestor of the elements\n   selected by the selectors given in parameter.\n - selector.`next(selector)` - Retrieves the next sibling that matches selector.\n - selector.`prev(selector)` - Retrieves the preceding sibling that matches selector.\n\n\nCustom selectors\n----------------\n\nCustom selector can be added to selector.selectorMap,\nwhere method shortcuts are available (m->matches, c->closest, n->next, p->prev).\n\n - `_` - node.\n - `v` - part between `()` in `:nth-child(2n+1)`.\n - `a` and `b` can be used as temp variables.\n\n```javascript\n// Add `:input` selector\nselector.selectorMap.input = \"_.tagName=='INPUT'\"\n\n// Add `:val()` selector\nselector.selectorMap.val = \"_.value==v\"\n```\n\nCoding Style Guidelines\n-----------------------\n\n - Use tabs for indentation, align with spaces\n - Use lowerCamelCase for method and variable names\n - Use UpperCamelCase for constructor names\n - Commit files with Unix-style line endings\n - Do not use spaces in file and directory names\n   Consider substituting a dash (-) where you would normally use spaces.\n - Rebase before pushing\n - Fix tests before push or pull request\n\n\n## External links\n\n[GitHub repo](https://github.com/litejs/selector-lite) |\n[npm package](https://npmjs.org/package/selector-lite) |\n[DOM spec](https://dom.spec.whatwg.org/) |\n[Selectors Level 3](http://www.w3.org/TR/selectors/) |\n[Travis CI](https://travis-ci.org/litejs/selector-lite) |\n[Coveralls coverage](https://coveralls.io/github/litejs/selector-lite) |\n[Buy Me A Tea][8]\n\n\n## Licence\n\nCopyright (c) 2015-2019 Lauri Rooden &lt;lauri@rooden.ee&gt;  \n[The MIT License](http://lauri.rooden.ee/mit-license.txt)\n\n\n","_attachments":{},"homepage":"https://github.com/litejs/selector-lite#readme","bugs":{"url":"https://github.com/litejs/selector-lite/issues"},"license":"MIT"}