Add console.log protection to TrivialReporter.js

This commit is contained in:
ragaskar 2009-06-24 22:20:07 -07:00
parent 275b83cc52
commit 3ccb2e6e8d

View File

@ -59,3 +59,13 @@ jasmine.TrivialReporter.prototype.reportSpecResults = function(spec) {
jasmine.TrivialReporter.prototype.log = function() {
console.log.apply(console, arguments);
};
//protect against console.log incidents
if (!("console" in window) || !("firebug" in console)) {
var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
window.console = {};
for (var i = 0, len = names.length; i < len; ++i) {
window.console[names[i]] = function() {
};
}
}