IE8 don't knows the Array.forEach function (simple version fix)

pull/1751/head
goldquest 2013-04-17 16:51:43 +02:00
parent b08a6e522f
commit 566034ddf0
2 changed files with 19 additions and 0 deletions

View File

@ -162,6 +162,16 @@ function makeChangesetTracker(scheduler, apool, aceCallbacksProvider)
}
else
{
// add forEach function to Array.prototype for IE8
if (!('forEach' in Array.prototype)) {
Array.prototype.forEach= function(action, that /*opt*/) {
for (var i= 0, n= this.length; i<n; i++)
if (i in this)
action.call(that, this[i], i, this);
};
}
// Get my authorID
var authorId = parent.parent.pad.myUserInfo.userId;
// Rewrite apool authors with my author information

View File

@ -79,6 +79,15 @@ window.html10n = (function(window, document, undefined) {
return -1;
}
}
// fix Array.prototype.forEach in IE
if (!('forEach' in Array.prototype)) {
Array.prototype.forEach= function(action, that /*opt*/) {
for (var i= 0, n= this.length; i<n; i++)
if (i in this)
action.call(that, this[i], i, this);
};
}
/**
* MicroEvent - to make any js object an event emitter (server or browser)