Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 9: Client Detection > Quirks Detection

Quirks Detection

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:

image
var hasDontEnumQuirk = function(){
var o = { toString : function(){} };
for (var prop in o){
if (prop == "toString"){
return false;
}
}
return true;
}();

  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial