Permalink
Browse files

Fix IE lacking Array#map. Closes #70

  • Loading branch information...
1 parent e794aa4 commit a234be69475a98fca3234a73ab70018124ced5cb Simon B @piratpartiet committed Apr 21, 2010
Showing with 11 additions and 0 deletions.
  1. +11 −0 infrastructure/ace/www/ace2_outer.js
@@ -204,6 +204,17 @@ function Ace2Editor() {
'</head><body id="outerdocbody"><div id="sidediv"><!-- --></div><div id="linemetricsdiv">x</div><div id="overlaysdiv"><!-- --></div></body></html>'];
+ 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;

0 comments on commit a234be6

Please sign in to comment.