Internet Explorer 9中有关Element对象的错误?

时间:2013-03-05 14:50:18

标签: javascript internet-explorer-9

IE9中有关于Element对象的已知错误吗?

几周前,我将AOP.Dimensions类添加到我的javascript库中,并在IE9中每天进行测试。它一直很好用。直到现在 - 突然我在“e instanceof Element”表达式上收到此错误消息:

  

'元素'未定义

如果我打开另一个网页,例如google.com,以下工作正常从控制台:

document.body instanceof Element

对可能出错的任何建议?

AOP.Dimensions = function(e){
  // Init:
  var _this = this;
  this.CLASS_NAME = 'AOP.Dimensions';

  if(!(e instanceof Element)){ 
    AOP.log(this.CLASS_NAME+' error: Invalid argument.',arguments,this); 
    return false; 
  }

  var $e = $(e)
    , off = $e.offset()
    , w = $e.outerWidth(true)
    , h = $e.outerHeight(true)
  ;
  // Visible?
  var V = this.visible = ( e.style.display === 'none' || e.style.visibility === 'hidden' ) ? false : true ;

  // Properties:
  this.element = e;
  this.offset = V ? off : {left:0, top:0};

  this.left = V ? off.left : 0 ;
  this.top = V ? off.top : 0 ;
  this.right = V ? this.left + w : 0 ;
  this.bottom = V ? this.top + h : 0 ;

  this.width = V ? w : 0 ;
  this.insideWidth = V ? $e.width() : 0 ;

  this.height = V ? h : 0 ;
  this.insideHeight = V ? $e.height() : 0 ;

  this.hPad = V ? $e.innerWidth() - $e.width() : 0 ;
  this.vPad = V ? $e.innerHeight() - $e.height() : 0 ;

  this.hBorder = V ? (this.width - this.hPad) - this.insideWidth : 0 ;
  this.vBorder = V ? (this.height - this.vPad) - this.insideHeight : 0 ;

  this.insideTop = V ? this.top + (this.vBorder/2) + (this.vPad/2) : 0 ;
  this.insideBottom = V ? this.bottom - (this.vBorder/2) - (this.vPad/2) : 0 ;
  this.insideLeft = V ? this.left + (this.hBorder/2) + (this.hPad/2) : 0 ;
  this.insideRight = V ? this.right - (this.hBorder/2) - (this.hPad/2) : 0 ;

};

在Chrome 25和Firefox 19.0中一切正常。

0 个答案:

没有答案