【发布时间】:2013-07-23 17:42:43
【问题描述】:
我在 javascript 中有以下代码:
Array.prototype.any = function (test) {
if (!arguments.length)
return !!this.length;
var arguments = Array.prototype.slice.call(arguments, 1);
var functionTest = typeof test == "function" ? test : function (x) {return x == test;};
for (var i = 0, len = this.length; i < len; i++)
if (functionTest.apply(this[i], [this[i]].concat(arguments)))
return true;
return false;
};
当我使用 Asp.net bundle 压缩 JS 文件时,保留字“arguments”变成了一个 char 变量,就像一个字母“i”,但是我需要变量参数,因为它存储了函数的参数。
缩小后可以看到如下:
Array.prototype.any=function(n){var i,r,t,u;if(!i.length)return!!this.length;for(i=Array.prototype.slice.call(i,1),r=typeof n=="function"?n:function(t){return t==n},t=0,u=this.length;t<u;t++)if(r.apply(this[t],[this[t]].concat(i)))return!0;return!1}
有人知道我该如何防止这种变化吗?
【问题讨论】:
标签: asp.net-mvc-4 bundle minify