That should confirm 99% of what you can throw in jQuery with much less overhead
function validateQuery(str) {
try {
document.querySelector(str);
return true;
}
catch(e) {
}
return false;
}
edit: ok, this will not tell you what is wrong with him, but he (quickly) checks the correctness - at least you only need to check WHY it is invalid, not IF: p
source
share