mirror of
https://github.com/formbricks/formbricks.git
synced 2026-02-05 10:36:06 -06:00
Co-authored-by: Matthias Nannt <mail@matthiasnannt.com> Co-authored-by: pandeymangg <anshuman.pandey9999@gmail.com> Co-authored-by: Johannes <johannes@formbricks.com>
13 lines
277 B
TypeScript
13 lines
277 B
TypeScript
export const isValidCssSelector = (selector?: string) => {
|
|
if (!selector || selector.length === 0) {
|
|
return false;
|
|
}
|
|
const element = document.createElement("div");
|
|
try {
|
|
element.querySelector(selector);
|
|
} catch (err) {
|
|
return false;
|
|
}
|
|
return true;
|
|
};
|