};\r
if( ret = X.Dom.Image._actualSize[ img.src ] ) return ret;\r
};\r
- \r
+\r
// for Firefox, Safari, Google Chrome\r
if( img.naturalWidth ) return [ img.naturalWidth, img.naturalHeight ];\r
\r
// restore\r
run.height = memH;\r
} else {// for Opera and Other\r
- \r
- memW = img.width;\r
- memH = img.height;\r
- // keep current style\r
- img.removeAttribute( 'width' );\r
- img.removeAttribute( 'height' );\r
- w = img.width;\r
- h = img.height;\r
- img.width = memW;\r
- // restore\r
- img.height = memH;\r
+ \r
+ memW = w = img.width;\r
+ memH = h = img.height;\r
+ \r
+ if( img.removeAttribute ){ // Safari1.3 の Image は removeAttribute がない\r
+ // keep current style\r
+ img.removeAttribute( 'width' );\r
+ img.removeAttribute( 'height' );\r
+ \r
+ w = img.width;\r
+ h = img.height;\r
+ \r
+ // restore\r
+ img.width = memW;\r
+ img.height = memH;\r
+ };\r
};\r
\r
ret = X.Dom.Image._actualSize[ img.src ] = [ w, h ];\r
this.timeout = timeout || 10000;\r
this.xnode =\r
(\r
- window.Image ?\r
+ window[ 'Image' ] ?\r
X.Dom.Node( img = new Image() ) :\r
X.Dom.Node._systemNode.create( 'img', { src : abspath } )\r
)\r
.listen( 'abort', this )\r
.listen( X.Dom.Event.LOAD_ASSET_COMPLETE, this )\r
.listen( X.Dom.Event.LOAD_ASSET_ERROR, this );\r
- \r
img && ( img.src = abspath );\r
-\r
this._detect();\r
},\r
handleEvent : function( e ){\r
}, \r
_detect : function(){\r
if( this.finish === true ) return;\r
- if( this.xnode._rawNode.complete ){\r
+ if( this.xnode._rawNode && this.xnode._rawNode.complete ){\r
this.finish = true;\r
if( this.xnode._rawNode.width ) return;\r
this.timerID = this.asyncDispatch( 0, { type : X.Dom.Event.LOAD_ASSET_ERROR } );\r
};\r
if( ( this.tick += this.delay ) > this.timeout ){\r
this.finish = true;\r
- this.timerID = this.asyncDispatch( 0, { type : X.Dom.Event.LOAD_ASSET_ERROR } );\r
+ this.timerID = this.asyncDispatch( 0, { type : X.Dom.Event.LOAD_ASSET_ERROR, msg : 'timeout' } );\r
return;\r
};\r
this.timerID = X.Timer.once( this.delay, this, this._detect );\r