为了节省空间,我为代码中的函数创建了一大堆别名。它在 FF 中运行良好,但现在我正在尝试添加对 IE 的支持,但并不满意。
j=String;
f0=j.fromCharCode;
j=j.prototype;
j.f1=j.indexOf;
j.f2=j.lastIndexOf;
j.f3=j.concat;
j.f4=j.substring;
function alias(c,e){return function(){return c[e].apply(c,arguments);};}
w=window.location;
d=document;
b=document.body;
f5=alias(d,"createElement");
f6=alias(b,"appendChild");
f7=alias(d,"getElementById");
...etc
我确定 alias() 函数在 IE 中不起作用。有没有在两种浏览器中都可以使用的替代方法?