Fail more gracefully on pre-IE9 browsers (still room for improvement though)
This commit is contained in:
parent
d8debb5e3c
commit
fcb7c32909
6 changed files with 43 additions and 9 deletions
|
|
@ -249,7 +249,7 @@ Component.log = function(s, type)
|
|||
Component.msStart = usr.getTime();
|
||||
}
|
||||
msElapsed = usr.getTime() - Component.msStart;
|
||||
console.log(msElapsed + "ms: " + sMsg.replace(/\n/g, " "));
|
||||
if (window && window.console) console.log(msElapsed + "ms: " + sMsg.replace(/\n/g, " "));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -658,7 +658,7 @@ Component.prototype = {
|
|||
}
|
||||
control.value += s + "\n";
|
||||
control.scrollTop = control.scrollHeight;
|
||||
if (DEBUG) console.log(s);
|
||||
if (DEBUG && window && window.console) console.log(s);
|
||||
};
|
||||
}(control));
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -34,6 +34,28 @@
|
|||
|
||||
var usr = {};
|
||||
|
||||
/**
|
||||
* indexOf(a, t, i)
|
||||
*
|
||||
* @param {Array} a
|
||||
* @param {*} t
|
||||
* @param {number} [i]
|
||||
* @returns {number}
|
||||
*/
|
||||
usr.indexOf = function(a, t, i)
|
||||
{
|
||||
if (Array.prototype.indexOf) {
|
||||
return a.indexOf(t, i);
|
||||
}
|
||||
i = i || 0;
|
||||
if (i < 0) i += a.length;
|
||||
if (i < 0) i = 0;
|
||||
for (var n = a.length; i < n; i++) {
|
||||
if (i in a && a[i] === t) return i;
|
||||
}
|
||||
return -1;
|
||||
};
|
||||
|
||||
/**
|
||||
* binarySearch(a, v, fnCompare)
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in a new issue