Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Similar to capability detection, quirks detection aims to identify a particular behavior of the browser. Instead of looking for something that’s supported, however, quirks detection attempts to figure out what isn’t working correctly (“quirk” really means “bug”). This often involves running a short amount of code to determine that a feature isn’t working correctly. For example, a bug in Internet Explorer 8 and earlier causes instance properties with the same name as prototype properties whose [[Enumerable]] attribute is set to false to not appear in for-in loops. This quirk can be tested using the following code:
var hasDontEnumQuirk = function(){
var o = { toString : function(){} };
for (var prop in o){
if (prop == "toString"){
return false;
}
}
return true;
}();