1.0.0 • Published 8 years ago

safe-query-selector v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

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.