Skip to content Skip to sidebar Skip to footer

Javascript Namespace And Problem With Ie7

I implemented a Javascript namespacing solution based on this answer to another stack overflow question: How do I declare a namespace in JavaScript? Let's call this isigma-ns.js: v

Solution 1:

It is the comma after "Reason". See: http://jsbin.com/upiba5/2/edit Edit: on your live site, the extra comma I see is after:

documentLockedByAnother: "This document is currently locked by another user, try again later",

varISIGMA = {
  messages: {
    noValidId: "No valid ID found",
    reason: "Reason"// etc...
  },

  language: "ca",
  SIGN: 2,
  PAUSE: 400,
  params: {},

  init: function(params) {
    // etc...
  },

  delay: function(callback) {
    // etc...
  },

  // etc...signURL: function(cert, url) {
    // etc... 
  }
};

Solution 2:

You need to remove the last comma after all the properties/methods you have defined.

older versions of IE choked on this.

var ISIGMA = {
  messages: {
    noValidId: "No valid ID found",
    reason: "Reason",
    // etc...
  },

  language: "ca",
  SIGN: 2,
  PAUSE: 400,
  params: {},

  init: function(params) {
    // etc...
  },

  delay: function(callback) {
    // etc...
  },<====-- ifthisis the LAST property/method, you need to omit the comma.

  // etc...
};

Update: another potential issue can arise from "self-closing" script tags. Be sure you have no external scripts referenced like this:

<scriptsrc="..."/><!--prone to parsing bugs/errors-->

vs.

<scriptsrc="..."></script><!--correct-->

Solution 3:

You have two external scripts loading and then immediately run an inline script. Scripts can load asynchronously or even fail to load at all. It is possible for browsers to single task and complete loading one script before moving on to the next script and it is possible for them to run multiple concurrent requests and it is possible for them to wait until all external requests have completed before continuing parsing inline scripts; but you have little (if any) control over which of those options any specific browser decides to implement. I don't have IE7, so I cannot experiment to see if its action differs from IE8's. You should ensure that the 2nd script has fully loaded before running the inline script.

Post a Comment for "Javascript Namespace And Problem With Ie7"