safe-query-selector
v1.0.0
Published
Safe version of querySelector() and querySelectorAll() methods. It never throws an error.
Downloads
10
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, defaultdocument
)
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, defaultdocument
)
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 [email protected].
License
safeQuerySelector is published under the MIT license.