Graduated to github: https://github.com/devinrhode2/StrictjQuery.js
But for the simple version (quite possibly better): (wait no its broke use the one on GH)
Warns when you have an empty jQuery selection, unless you do $('foo', failsafe);
$.badSelectorAction = function badSelectorActionFn( selector, context ) {
console.warn('Empty selection for selector:', selector, 'context:', context);
};
window.failsafe = 'failsafe';
jQuery.fn.oldInit = jQuery.fn.init;
var rootjQuery = jQuery(document);
jQuery.fn.init = function strictSelectorOverride( selector, context ) {
var result = jQuery.fn.oldInit.call(this, selector, context, rootjQuery);
if (typeof selector === 'string') {
if (result || context === failsafe) {
return result;
} else {
$.badSelectorError( selector, context );
}
} else {
return result;
}
};