There is some JavaScript code in modules/system/system.js that includes some trailing commas after object property definitions. Non-IE browsers do not care about these commas, but IE considers them to be a syntax error and will bail out on the entire JS file. Most users won't even notice this, but I happened to have JS debugging turned on in IE and got a lovely white screen with a error message. An image is attached.

I'll roll a patch later today or someone else can since it's such a small change.

For those unsure of what I'm talking about, see the bolded code below. What I'm referring to is the isolated "}," on the second to last line in the two examples.

Drupal.behaviors.userTimeZones = {
  attach: function (context, settings) {
    $('#empty-timezone-message-wrapper .description').hide();
    $('#edit-configurable-timezones', context).change(function () {
      $('#empty-timezone-message-wrapper').toggle();
    });
  },
};
Drupal.behaviors.pageCache = {
  attach: function (context, settings) {
    $('#edit-cache-0', context).change(function () {
      $('#page-compression-wrapper').hide();
      $('#cache-error').hide();
    });
    $('#edit-cache-1', context).change(function () {
      $('#page-compression-wrapper').show();
      $('#cache-error').hide();
    });
    $('#edit-cache-2', context).change(function () {
      $('#page-compression-wrapper').show();
      $('#cache-error').show();
    });
  },
};
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

CalebD’s picture

Status: Active » Needs review
FileSize
696 bytes

Patch attached. Pretty straight forward.

CalebD’s picture

Issue tags: +JavaScript, +Quick fix

Now with delicious tags!

Damien Tournoud’s picture

Status: Needs review » Reviewed & tested by the community

Make sense.

@CalebD: could you check the other javascript files to see if we have this type of issue elsewhere?

CalebD’s picture

Status: Reviewed & tested by the community » Needs work

misc/ajax.js also has the same problem on line 99. Will have a patch shortly.

CalebD’s picture

Status: Needs work » Needs review
FileSize
1.15 KB

Updated patch.

CalebD’s picture

Title: Trailing commas in system.js break JS in IE » Trailing commas in JavaScript cause syntax errors in IE

Better title.

cwgordon7’s picture

Status: Needs review » Reviewed & tested by the community

Looks great, awesome!

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD. Thanks!

Status: Fixed » Closed (fixed)
Issue tags: -JavaScript, -Quick fix

Automatically closed -- issue fixed for 2 weeks with no activity.