user4739617
user4739617

Reputation:

ie8 Object doesn't support this for extjs code

allWidth: function() {
    var me = this,
        states = me.getstates(),
        waterY = 0,
        placeY = 0,
        World;

    states.forEach(function(region) {
        World = region.getWorld();
        if (World.y < placeY) {
            placeY = World.y;
        }
        if (World.y + World.height > waterY) {
            waterY = World.y + World.height;
        }
    });

    return waterY - placeY;
},

Upvotes: 0

Views: 88

Answers (1)

nderscore
nderscore

Reputation: 4251

IE8 doesn't support the forEach method for Arrays. You have a few options to fix this.

You could use a normal for loop:

for(var i = 0; i < states.length; i++){
    var region = states[i];
    /* ... */

Since you're using extjs, you could also use the Ext.each method instead:

Ext.each(states, function(region){
...

Or you could use a shim/polyfill to add the forEach method in IE8.

You can find a polyfill for the forEach method on MDN here.

Upvotes: 1

Related Questions