From a234be69475a98fca3234a73ab70018124ced5cb Mon Sep 17 00:00:00 2001 From: "Simon B @piratpartiet" Date: Wed, 21 Apr 2010 10:57:14 +0200 Subject: Fix IE lacking Array#map. Closes #70 --- infrastructure/ace/www/ace2_outer.js | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'infrastructure/ace/www') diff --git a/infrastructure/ace/www/ace2_outer.js b/infrastructure/ace/www/ace2_outer.js index 212c159..f947534 100644 --- a/infrastructure/ace/www/ace2_outer.js +++ b/infrastructure/ace/www/ace2_outer.js @@ -204,6 +204,17 @@ function Ace2Editor() { '
x
']; + if (!Array.prototype.map) Array.prototype.map = function(fun) { //needed for IE + if (typeof fun != "function") throw new TypeError(); + var len = this.length; + var res = new Array(len); + var thisp = arguments[1]; + for (var i = 0; i < len; i++) { + if (i in this) res[i] = fun.call(thisp, this[i], i, this); + } + return res; + }; + var outerFrame = document.createElement("IFRAME"); outerFrame.frameBorder = 0; // for IE info.frame = outerFrame; -- cgit v1.2.3