TypedArray.js“对象不支持此操作”ie8

时间:2014-08-28 14:33:40

标签: javascript internet-explorer-8 typedarray

在Polyfill" typedarray.js"的这个片段中,我收到错误@以下评论部分

(function() {
  var orig = Object.defineProperty;
  var dom_only = !(function(){
    try{
      return Object.defineProperty({},'x',{});
    } catch(_) {
      return false;
    }
  }());
  if (!orig || dom_only) {
    Object.defineProperty = function (o, prop, desc) {
    // In IE8 try built-in implementation for defining properties on DOM prototypes.
      if (orig)
        try {
          return orig(o, prop, desc);
        } catch (_) {} //<--here throws "Object does not support this action"
      if (o !== Object(o))
        throw TypeError('Object.defineProperty called on non-object');
      if (Object.prototype.__defineGetter__ && ('get' in desc))
        Object.prototype.__defineGetter__.call(o, prop, desc.get);
      if (Object.prototype.__defineSetter__ && ('set' in desc))
        Object.prototype.__defineSetter__.call(o, prop, desc.set);
      if ('value' in desc)
        o[prop] = desc.value;
      return o;
    };
  }
}());

在IE8中我只会抛出此错误。任何人都可以提供一些澄清原因吗?我已经看过类似的其他问题,但这对我没有意义。我是一个相当新的网络开发人员,如果这可能有助于你制定回应。

0 个答案:

没有答案
相关问题