* 孤立するとウィンドウ オブジェクトのプロパティが消去される\r
*/\r
\r
+// TODO Node.inherits\r
X.Util.NinjaIframe = X.EventDispatcher.inherits(\r
'NinjaIframe',\r
{\r
\r
_iwin : null,\r
\r
- _html : '',\r
+ _contentHTML : '',\r
_name : '',\r
_ready : false,\r
\r
{\r
className : 'hidden-iframe',\r
scrolling : 'no',\r
+ allowtransparency : 'no', \r
frameborder : 0,\r
- allowtransparency : 'no',\r
+ tabindex : -1,\r
name : this._name,\r
id : this._name\r
}\r
);\r
\r
- X.ViewPort.listenOnce( X.Event.AFTER_UPDATE, this );\r
+ X_ViewPort.listenOnce( X.Event.AFTER_UPDATE, this );\r
\r
// http://nanto.asablo.jp/blog/2011/12/08/6237308\r
// IE 6/7 で文書間通信を実現するための一案\r
this.xnodeIframe.css( { position : 'absolute' } );\r
};\r
\r
- if( html ) this._html = html;\r
+ if( html ) this._contentHTML = html;\r
},\r
\r
handleEvent : function( e ){\r
- var raw = this.xnodeIframe._rawObject,\r
- html, idoc;\r
+ var raw = this.xnodeIframe._rawObject;\r
\r
switch( e.type ){\r
case X.Event.AFTER_UPDATE :\r
- this._iwin = raw.contentWindow || raw.contentDocument && raw.contentDocument.parentWindow || window.frames[ this._name ];\r
+ this._iwin = raw.contentWindow || ( raw.contentDocument && raw.contentDocument.parentWindow ) || window.frames[ this._name ];\r
+ // http://d.hatena.ne.jp/NeoCat/20080921/1221940658\r
+ // こちらに名前をsetしないとtargetが動作しない\r
+ if( X_UA.IE ) this._iwin.name = this._name;\r
\r
- this.xnodeIframe.listen( X_UA.IE < 9 ? [ 'readystatechange', 'error' ] : [ 'load', 'error' ], this );\r
+ this.xnodeIframe.listen( [ X_UA.IE < 9 ? 'readystatechange' : 'load', 'error' ], this );\r
\r
if( !( X_UA.IE < 9 ) ){\r
- this._html && X_Util_NinjaIframe_writeToIframe( this );\r
+ this._contentHTML && X_Util_NinjaIframe_writeToIframe( this );\r
this._ready = true;\r
return;\r
};\r
\r
case 'readystatechange' :\r
- if( ( raw.readyState !== 'complete' && raw.readyState !== 'loaded' ) ) return X.Callback.STOP_PROPAGATION;\r
+ if( ( raw.readyState !== 'complete' && raw.readyState !== 'loaded' ) ) break;\r
// ie9-\r
if( !this._ready ){\r
- this._html && X_Util_NinjaIframe_writeToIframe( this );\r
+ this._contentHTML && X_Util_NinjaIframe_writeToIframe( this );\r
this._ready = true;\r
- return; \r
+ break;\r
};\r
// onload\r
case 'load' :\r
return X.Callback.STOP_PROPAGATION; \r
},\r
\r
- refresh : function( opt_html ){\r
+ refresh : function( opt_contentHTML ){\r
var raw = this.xnodeIframe._rawObject,\r
idoc;\r
\r
this._ready = false;\r
\r
if( !this._iwin ){\r
- this._html = opt_html;\r
+ this._contentHTML = opt_contentHTML;\r
return this;\r
};\r
\r
this._iwin.location.reload();\r
};\r
\r
- if( !opt_html ) return this;\r
+ if( !opt_contentHTML ) return this;\r
\r
- this._html = opt_html;\r
+ this._contentHTML = opt_contentHTML;\r
X_UA.IE < 9 || X_Util_NinjaIframe_writeToIframe( this );\r
\r
return this;\r
function X_Util_NinjaIframe_writeToIframe( that ){\r
var raw = that.xnodeIframe._rawObject,\r
idoc = raw.contentDocument || that._iwin.document,\r
- html = that._html;\r
+ html = that._contentHTML;\r
\r
- delete that._html;\r
+ delete that._contentHTML;\r
that._ready = true;\r
\r
idoc.open();\r