From dabba91152d992d092a03e813d05701d7487d9c8 Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Tue, 23 Jul 2013 12:42:55 +0200 Subject: [PATCH] Update html10n.js --- src/static/js/html10n.js | 147 ++++++++++++++++++++++----------------- 1 file changed, 84 insertions(+), 63 deletions(-) diff --git a/src/static/js/html10n.js b/src/static/js/html10n.js index 90d51e221..bee1fef38 100644 --- a/src/static/js/html10n.js +++ b/src/static/js/html10n.js @@ -46,7 +46,20 @@ window.html10n = (function(window, document, undefined) { , consoleError = interceptConsole('warn') - // fix Array.prototype.instanceOf in, guess what, IE! <3 + // fix Array#forEach in IE + // taken from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach + if (!Array.prototype.forEach) { + Array.prototype.forEach = function(fn, scope) { + for(var i = 0, len = this.length; i < len; ++i) { + if (i in this) { + fn.call(scope, this[i], i, this); + } + } + }; + } + + // fix Array#indexOf in, guess what, IE! <3 + // taken from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf if (!Array.prototype.indexOf) { Array.prototype.indexOf = function (searchElement /*, fromIndex */ ) { "use strict"; @@ -79,15 +92,6 @@ 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