Internet Explorer Doesn't Like Your Trailing Commas

Internet Explorer Icon

I just got bit by a strange bug that I haven't encountered before and wanted to share the 5 minute solution with everyone so they don't spend the hour I did trying to install Visual Web Developer Lite in a virtual machine to debug IE's Javascript wackiness.

Firefox could care less if you write your code like this:

      address: {
        required: true,
        minlength: 2,
      },
      city: {
        required: true,
        minlength: 2,
      },
      state: {
        required: true,
      },

But apparently IE blindly chokes unless you write it like this:

      address: {
        required: true,
        minlength: 2
      },
      city: {
        required: true,
        minlength: 2
      },
      state: {
        required: true
      },

Notice all the trailing commas removed, even from one line items. Not sure who is implementing the spec correctly here, but sure makes for a thorny problem when the best tool for JS debugging is Firebug in Firefox and therefore most initial development is done in Firefox.

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options