# safe-query-selector

> Safe version of querySelector() and querySelectorAll() methods. It never throws an error.

Latest version **1.0.0** (published 2016-05-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install safe-query-selector
pnpm add safe-query-selector
yarn add safe-query-selector
bun add safe-query-selector
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2016-05-27 |
| First published | 2016-05-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Riki Fridrich |
| Maintainers | fczbkk |

## Links

- npm: https://www.npmjs.com/package/safe-query-selector
- Repository: https://github.com/fczbkk/safe-query-selector
- Homepage: https://github.com/fczbkk/safe-query-selector#readme
- Issues: https://github.com/fczbkk/safe-query-selector/issues
- npm.io page: https://npm.io/package/safe-query-selector

## Recent versions

- 1.0.0 (latest) — 2016-05-27

## README

# safeQuerySelector

Safe version of querySelector() and querySelectorAll() methods. It never throws an error.

## Documentation

### safeQuerySelector

Returns first matching element that is child of root node, or `null` if not found.

**Parameters**

-   `selector` **Any** CSS selector. Should be string.
-   `root` **\[Any]** Node inside which the selector will be applied. (optional, default `document`)

Returns **([Element](https://developer.mozilla.org/en-US/docs/Web/API/Element) | null)** 

### safeQuerySelectorAll

Returns collection of all matching elements that are children of root node, or an empty array if not found.

**Parameters**

-   `selector` **Any** CSS selector. Should be string.
-   `root` **\[Any]** Node inside which the selector will be applied. (optional, default `document`)

Returns **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)** 

## Bug reports, feature requests and contact

If you found any bugs, if you have feature requests or any questions, please, either [file an issue at GitHub](https://github.com/fczbkk/safe-query-selector/issues) or send me an e-mail at <a href="mailto:riki@fczbkk.com">riki@fczbkk.com</a>.

## License

safeQuerySelector is published under the [MIT license](https://github.com/fczbkk/safe-query-selector/blob/master/LICENSE).

---
_Source: https://npm.io/package/safe-query-selector · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
