IE: Sucking Hard Since Version 5
Adam Scheinberg, July 9, 2009 (16 years ago)
This code (extracted from a javascript file) works in every major browser except IE (including IE8):
This is the fix:
See the difference? Yeah, neither did I. The difference is the last comma in the argument list.
That's 3 consecutive major versions of IE that have been absolutely crap. Why anyone continues to use IE is beyond me. IE: sucking hard since version 5.
    
         $('a[rel*=fancybox]').fancybox({
          'frameWidth' : 500,
          'frameHeight' : 465,
          'hideOnContentClick' : false,
          'centerOnScroll' : true,
     });This is the fix:
     $('a[rel*=fancybox]').fancybox({
          'frameWidth' : 500,
          'frameHeight' : 465,
          'hideOnContentClick' : false,
          'centerOnScroll' : true
     });See the difference? Yeah, neither did I. The difference is the last comma in the argument list.
That's 3 consecutive major versions of IE that have been absolutely crap. Why anyone continues to use IE is beyond me. IE: sucking hard since version 5.
From ECMA-262, 11.1.5:
ObjectLiteral :
{}
{ PropertyNameAndValueList }
PropertyNameAndValueList :
PropertyName : AssignmentExpression
PropertyNameAndValueList , PropertyName : AssignmentExpression
As much as I detest being on the same side as MicroSoft, the trailing comma is, in fact, a syntax error which should be caught. While it might be an inadvertent interpretation of comma as terminator rather than separator, it might just as easily be interpreted as a missing list element.
Tracking down syntactically correct semantic errors is difficult enough; letting syntax errors slip through (without at least a warning message) makes tracking them down even more difficult.
James