safe-query-selector

1.0.0 • Public • Published

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 | 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

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 or send me an e-mail at riki@fczbkk.com.

License

safeQuerySelector is published under the MIT license.

Readme

Keywords

none

Package Sidebar

Install

npm i safe-query-selector

Weekly Downloads

2

Version

1.0.0

License

MIT

Last publish

Collaborators

  • fczbkk