I added the AOP.Dimensions class below to my javascript library a couple of weeks ago and tested it daily in IE9. It has been working fine all along. Until now - suddenly I get this error message on the "e instanceof Element" expression:
'Element' is undefined
If I open another web page, e.g. google.com, the following works fine from the console:
Code JavaScript:document.body instanceof Element
Any suggestions to what might have gone wrong?
Code JavaScript: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 ; };
It all works fine in Chrome 25 and Firefox 19.0.



Reply With Quote






Bookmarks