Created
April 30, 2022 02:58
-
-
Save robsonsobral/64c8100d51f8ebe3154c8b0f24fa8ac6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const queryCheck = (s) => document.createDocumentFragment().querySelector(s); | |
export default function isSelectorValid(selector) { | |
if (typeof selector !== 'string') return false; | |
try { queryCheck(selector); } catch { return false; } | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment