diff --git a/README.md b/README.md index ae5507c..d03309b 100644 --- a/README.md +++ b/README.md @@ -3,14 +3,22 @@ [![Build Status](https://travis-ci.org/lbenie/qselector.svg?branch=master)](https://travis-ci.org/lbenie/qselector) [![Mutation testing badge](https://badge.stryker-mutator.io/github.com/lbenie/qselector/master)](https://stryker-mutator.github.io) [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/) +[![license](https://img.shields.io/github/license/lbenie/qselector.svg)](https://github.com/lbenie/qselector) [![Known Vulnerabilities](https://snyk.io/test/github/lbenie/qselector/badge.svg?targetFile=package.json)](https://snyk.io/test/github/lbenie/qselector?targetFile=package.json) +[![npm](https://img.shields.io/npm/v/qselector.svg)](https://github.com/lbenie/qselector) +[![npm bundle size (minified)](https://img.shields.io/bundlephobia/min/qselector.svg)](https://github.com/lbenie/qselector) +[![npm bundle size (minified + gzip)](https://img.shields.io/bundlephobia/minzip/qselector.svg)](https://github.com/lbenie/qselector) -qselector (query selector) is just a small package to create aliases for `querySelector` and `querySelectorAll` to `$` and `$$` respectively. +qselector (query selector) is just a small package to create aliases for +`querySelector` and `querySelectorAll` to `$` and `$$` respectively. ## API -The api is pretty simple. Each functions receive a DOMElement and returns either the node or a list of node. + +The api is pretty simple. Each functions receive a DOMElement and returns either +the node or a list of node. **Example** + ```html
s @@ -24,9 +32,10 @@ The api is pretty simple. Each functions receive a DOMElement and returns either **$(el, selector)** Returns the first match of `selector` on `el` and its children + ```js - let node = $('div'); - /* node value +let node = $('div'); +/* node value
s t @@ -36,8 +45,8 @@ Returns the first match of `selector` on `el` and its children
*/ - node = $('span', '.test'); - /* node value +node = $('span', '.test'); +/* node value s */ ``` @@ -45,19 +54,21 @@ Returns the first match of `selector` on `el` and its children **$$(el, selector)** Returns the list of all matches of `selector` on `el` and its children + ```js - let node = $$('div'); - /* node value +let node = $$('div'); +/* node value [div.test, div.retest] */ - node = $$('.test', 'span'); - /* node value +node = $$('.test', 'span'); +/* node value [span, span] */ ``` ## Installation + ```bash $ yarn add qselector ``` @@ -69,24 +80,24 @@ or ``` ## License + (MIT) Copyright (c) 2018 Lucien Bénié -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.