我正在编写一些使用Object.bind
方法的JavaScript代码。
funcabc = function(x, y, z){
this.myx = x;
this.playUB = function(w) {
if ( this.myx === null ) {
// do blah blah
return;
}
// do other stuff
};
this.play = this.playUB.bind(this);
};
由于我使用WinXP开发Firefox,有时在Win7上测试IE 9或10,因此并没有注意到或关注到IE8及以下版本不支持bind
。
这个脚本没有使用canvas,所以我有点犹豫是否放弃所有的IE 8用户。
是否有标准的解决方法?
我在JavaScript方面还算可以,但我还是一个新手。如果解决方案非常明显,请原谅我。
不支持以下文档模式:Quirks、Internet Explorer 6 标准、Internet Explorer 7 标准、Internet Explorer 8 标准。
- Alexander