summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgoldquest <tjwelde@gmail.com>2013-04-17 16:51:43 +0200
committergoldquest <tjwelde@gmail.com>2013-04-17 16:51:43 +0200
commit566034ddf0d3ede031389b58253939967a170343 (patch)
treec81d264cfabcd0545c009d36b6113316c32dc79d
parentb08a6e522f3c98c81377ac10e58fd4020b3b47e6 (diff)
downloadetherpad-lite-566034ddf0d3ede031389b58253939967a170343.zip
IE8 don't knows the Array.forEach function (simple version fix)
-rw-r--r--src/static/js/changesettracker.js10
-rw-r--r--src/static/js/html10n.js9
2 files changed, 19 insertions, 0 deletions
diff --git a/src/static/js/changesettracker.js b/src/static/js/changesettracker.js
index 92d55092..b93fcc17 100644
--- a/src/static/js/changesettracker.js
+++ b/src/static/js/changesettracker.js
@@ -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
diff --git a/src/static/js/html10n.js b/src/static/js/html10n.js
index e1c884cd..050601d1 100644
--- a/src/static/js/html10n.js
+++ b/src/static/js/html10n.js
@@ -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)