Debug variables
I have this jquery extension and resharper warns me about expression is always false on _DEBUG checks
How can I tell resharper that it's just a debug switch
$.fn.search = function (query) {
var _DEBUG = false;
var ele = $(this);
var returnVal;
while ((returnVal = ele.findorself(query)).length === 0 && !ele.is("body") && ele.length > 0) {
ele = ele.parent();
if (_DEBUG) console.log(ele);
}
if (_DEBUG) console.log(returnVal);
if (ele.is("body") && _DEBUG) console.log("Not found");
if (ele.length === 0 && _DEBUG) console.log("Attempted to exceed the root element without adding it to page first");
return returnVal;
};
$.fn.findorself = function (query) {
if ($(this).is(query))
return $(this);
return $(this).find(query);
};
if ($(this).is(query))
return $(this);
return $(this).find(query);
};
Please sign in to leave a comment.