X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=0.6.x%2Fjs%2F01_core%2F21_XViewPort.js;h=5c469020eb9bc48b1fb4dacb8ea3c06ab30614c0;hb=HEAD;hp=2349dde323658b2bdab97afd6f15875a0308777a;hpb=475df4df9670f042764a99c80d7716e994d28033;p=pettanr%2FclientJs.git diff --git a/0.6.x/js/01_core/21_XViewPort.js b/0.6.x/js/01_core/21_XViewPort.js index 2349dde..5c46902 100644 --- a/0.6.x/js/01_core/21_XViewPort.js +++ b/0.6.x/js/01_core/21_XViewPort.js @@ -1,6 +1,6 @@ var X_ViewPort_readyState, - X_ViewPort_active = !!window.parent || !!document.activeElement, // parent は frameに読み込まれた場合のieのerror回避 + X_ViewPort_active = ( window.parent === window ) || !window.parent, // parent は frameに読み込まれた場合のieのerror回避 X_ViewPort_activeTimerID, X_ViewPort_rootElement, X_ViewPort_lock, @@ -35,13 +35,13 @@ X_ViewPort = X_Class_override( { 'handleEvent' : function( e ){ - var href, i, name, active = false, xnode; + var href, i, name, active = false, elm, xnode; switch( e.type ){ case 'beforeunload' : - // ie では a href='javascript' な要素でも beforeunload が起こる + // ie では a href='javascript' な要素でも beforeunload が起こる href = e.target && e.target[ 'attr' ] && e.target[ 'attr' ]( 'href' ); - if( href && href.indexOf && href.indexOf( 'javascript:' ) === 0 ) return X_CALLBACK_PREVENT_DEFAULT | X_CALLBACK_STOP_PROPAGATION; + if( X_Type_isString( href ) && !href.toLowerCase().indexOf( 'javascript:' ) ) return X_CALLBACK_PREVENT_DEFAULT | X_CALLBACK_STOP_PROPAGATION; return X_ViewPort[ 'dispatch' ]( X_EVENT_BEFORE_UNLOAD ); @@ -49,34 +49,35 @@ X_ViewPort = X_Class_override( //https://developer.mozilla.org/ja/docs/Web/JavaScript/A_re-introduction_to_JavaScript //Firefox 1.5 の bfcache が無効になりますので、他に理由がない限り Firefox では unload リスナを登録するべきではないことに注意してください。 X_ViewPort[ 'dispatch' ]( X_EVENT_UNLOAD ); - //alert('unload'); + //alert('unload'); X_ViewPort_document[ 'kill' ](); - this[ 'kill' ](); - + X_ViewPort[ 'kill' ](); //X_System[ 'dispatch' ]( X_EVENT_SHUT_DOWN ); break; case 'visibilitychange' : console.log( e.type + ':' + document[ 'hidden' ] ); - X_ViewPort[ 'dispatch' ]( ( X_ViewPort_active = document[ 'hidden' ] ) ? X_EVENT_VIEW_DEACTIVATE : X_EVENT_VIEW_ACTIVATE ); + X_ViewPort[ 'dispatch' ]( ( X_ViewPort_active = !document[ 'hidden' ] ) ? X_EVENT_VIEW_ACTIVATE : X_EVENT_VIEW_DEACTIVATE ); break; case 'msvisibilitychange' : - X_ViewPort[ 'dispatch' ]( ( X_ViewPort_active = document[ 'msHidden' ] ) ? X_EVENT_VIEW_DEACTIVATE : X_EVENT_VIEW_ACTIVATE ); + console.log( e.type + ':' + document[ 'msHidden' ] ); + X_ViewPort[ 'dispatch' ]( ( X_ViewPort_active = !document[ 'msHidden' ] ) ? X_EVENT_VIEW_ACTIVATE : X_EVENT_VIEW_DEACTIVATE ); break; case 'mozvisibilitychange' : - X_ViewPort[ 'dispatch' ]( ( X_ViewPort_active = document[ 'mozHidden' ] ) ? X_EVENT_VIEW_DEACTIVATE : X_EVENT_VIEW_ACTIVATE ); + console.log( e.type + ':' + document[ 'mozHidden' ] ); + X_ViewPort[ 'dispatch' ]( ( X_ViewPort_active = !document[ 'mozHidden' ] ) ? X_EVENT_VIEW_ACTIVATE : X_EVENT_VIEW_DEACTIVATE ); break; case 'webkitvisibilitychange' : console.log( e.type + ':' + document[ 'webkitHidden' ] ); - X_ViewPort[ 'dispatch' ]( ( X_ViewPort_active = document[ 'webkitHidden' ] ) ? X_EVENT_VIEW_DEACTIVATE : X_EVENT_VIEW_ACTIVATE ); + X_ViewPort[ 'dispatch' ]( ( X_ViewPort_active = !document[ 'webkitHidden' ] ) ? X_EVENT_VIEW_ACTIVATE : X_EVENT_VIEW_DEACTIVATE ); break; case 'blur' : case 'focusout' : - if( X_UA[ 'IE' ] < 9 ){ - xnode = X_Node_getXNode( document.activeElement ); + if( X_UA[ 'IE' ] < 9 && ( elm = FocusUtility_getFocusedElement() ) ){ + xnode = X_Node_getXNode( elm ); if( xnode ){ - xnode[ 'listen' ]( [ 'focus', 'blur' ], X_ViewPort_detectFocusForIE ); + xnode[ 'listenOnce' ]( [ 'focus', 'blur' ], X_ViewPort_detectFocusForIE ); //break; }; if( X_ViewPort_activeTimerID ){ @@ -85,6 +86,8 @@ X_ViewPort = X_Class_override( X_ViewPort_activeTimerID = X_Timer_once( 16, X_ViewPort_changeFocus ); return X_CALLBACK_PREVENT_DEFAULT | X_CALLBACK_STOP_PROPAGATION; }; + // 他の要素のfocusout がバブルアップしてきたもの + if( e.target !== X_ViewPort_document ) break; case 'pagehide' : active = true; case 'focus' : @@ -103,15 +106,23 @@ X_ViewPort = X_Class_override( ); function X_ViewPort_detectFocusForIE( e ){ - console.log( 'iefix! ' + e.type + ':' + this.attr( 'tag' ) + ' isActive?:' + ( this[ '_rawObject' ] === document.activeElement ) ); - + //console.log( 'iefix! ' + e.type + ':' + this.attr( 'tag' ) + ' isActive?:' + ( this[ '_rawObject' ] === document.activeElement ) ); + var elmActive = FocusUtility_getFocusedElement(); X_ViewPort_active = e.type === 'focus'; - if( this[ '_rawObject' ] !== document.activeElement ){ + + if( elmActive && this[ '_rawObject' ] !== elmActive ){ this[ 'unlisten' ]( X_ViewPort_active ? 'blur' : 'focus', X_ViewPort_detectFocusForIE ); + console.log( '>>>>>> activeElement 取得 不一致 ' + this._tag ); + } else + if( !elmActive ){ + //console.log( '******** activeElement 取得のエラー' ); + } else if( elmActive ){ + //console.log( '>>>>>> activeElement 取得' ); }; + if( X_ViewPort_activeTimerID ){ - X_ViewPort_activeTimerID = X_Timer_remove( X_ViewPort_activeTimerID ); + X_Timer_remove( X_ViewPort_activeTimerID ); }; X_ViewPort_activeTimerID = X_Timer_once( 16, X_ViewPort_changeFocus ); @@ -124,6 +135,7 @@ function X_ViewPort_changeFocus(){ }; +// TODO EventDispatcherProxy /** * window に相当する ViewPort 情報を提供するオブジェクト。 * @namespace X.ViewPort @@ -145,10 +157,10 @@ X[ 'ViewPort' ] = { }; f = X_Closure_classifyCallbackArgs( arg1, arg2, arg3 ); - if( !f.kind ){ + if( !f.cbKind ){ X_ViewPort[ 'listen' ]( type, this, arg1 ); } else - if( f.kind === X_CLOSURE_FUNC_ONLY ){ + if( f.cbKind === X_CLOSURE_FUNC_ONLY ){ X_ViewPort[ 'listen' ]( type, this, f.func, f.supplement ); } else { X_ViewPort[ 'listen' ]( type, arg1, arg2, arg3 ); @@ -171,10 +183,10 @@ X[ 'ViewPort' ] = { }; f = X_Closure_classifyCallbackArgs( arg1, arg2, arg3 ); - if( !f.kind ){ + if( !f.cbKind ){ X_ViewPort[ 'listenOnce' ]( type, this, arg1 ); } else - if( f.kind === X_CLOSURE_FUNC_ONLY ){ + if( f.cbKind === X_CLOSURE_FUNC_ONLY ){ X_ViewPort[ 'listenOnce' ]( type, this, f.func, f.supplement ); } else { X_ViewPort[ 'listenOnce' ]( type, arg1, arg2, arg3 ); @@ -189,10 +201,10 @@ X[ 'ViewPort' ] = { 'unlisten' : function( type, arg1, arg2, arg3 ){ var f = X_Closure_classifyCallbackArgs( arg1, arg2, arg3 ); - if( !f.kind ){ + if( !f.cbKind ){ X_ViewPort[ 'unlisten' ]( type, this, arg1 ); } else - if( f.kind === X_CLOSURE_FUNC_ONLY ){ + if( f.cbKind === X_CLOSURE_FUNC_ONLY ){ X_ViewPort[ 'unlisten' ]( type, this, f.func, f.supplement ); } else { X_ViewPort[ 'unlisten' ]( type, arg1, arg2, arg3 ); @@ -207,10 +219,10 @@ X[ 'ViewPort' ] = { 'listening' : function( type, arg1, arg2, arg3 ){ var f = X_Closure_classifyCallbackArgs( arg1, arg2, arg3 ); - if( !f.kind ){ + if( !f.cbKind ){ return X_ViewPort[ 'listening' ]( type, this, arg1 ); } else - if( f.kind === X_CLOSURE_FUNC_ONLY ){ + if( f.cbKind === X_CLOSURE_FUNC_ONLY ){ return X_ViewPort[ 'listening' ]( type, this, f.func, f.supplement ); }; return X_ViewPort[ 'listening' ]( type, arg1, arg2, arg3 ); @@ -244,11 +256,11 @@ X[ 'ViewPort' ] = { }, //https://developer.mozilla.org/en-US/docs/Web/API/Element.getBoundingClientRect //use window.pageXOffset and window.pageYOffset instead of window.scrollX and window.scrollY -//(((t = document.documentElement) || (t = document.body.parentNode)) && typeof t.ScrollLeft == 'number' ? t : document.body).ScrollLeft; -//(((t = document.documentElement) || (t = document.body.parentNode)) && typeof t.ScrollTop == 'number' ? t : document.body).ScrollTop +//(((t = document.documentElement) || (t = X_elmBody.parentNode)) && typeof t.ScrollLeft == 'number' ? t : X_elmBody).ScrollLeft; +//(((t = document.documentElement) || (t = X_elmBody.parentNode)) && typeof t.ScrollTop == 'number' ? t : X_elmBody).ScrollTop - /* - * TODO X.Doc へ + // TODO X.Doc へ + /** * @alias X.ViewPort.getDocumentSize */ 'getDocumentSize' : function(){ @@ -256,12 +268,13 @@ X[ 'ViewPort' ] = { // http://orera.g.hatena.ne.jp/edvakf/20100515/1273908051 //http://onozaty.hatenablog.com/entry/20060803/p1 // Safari2.0.4では標準・互換どちらも document.body + // http://hisasann.com/housetect/2008/08/jqueryheightwidthopera95.html このdocument.body[ "client" + name ]はおそらくOpera9.5未満のバージョンで有効なんじゃないかな? X_Node_updateTimerID && X_Node_startUpdate(); /*X_UA[ 'Opera' ] ? ( document.documentElement && document.documentElement.clientWidth ? new Function( 'return[document.documentElement.clientWidth,document.documentElement.clientHeight]' ) : - new Function( 'return[document.body.clientWidth,document.body.clientHeight]' ) + new Function( 'return[X_elmBody.clientWidth,X_elmBody.clientHeight]' ) ) :*/ return [ X_ViewPort_rootElement.scrollWidth || X_ViewPort_rootElement.offsetWidth, @@ -287,7 +300,7 @@ X[ 'ViewPort' ] = { ( function(){ X_Node_updateTimerID && X_Node_startUpdate(); // body は Safari2- - return[ X_ViewPort_scrollX = X_ViewPort_rootElement.scrollLeft || document.body.scrollLeft, X_ViewPort_scrollY = X_ViewPort_rootElement.scrollTop || document.body.scrollTop ]; + return[ X_ViewPort_scrollX = X_ViewPort_rootElement.scrollLeft || X_elmBody.scrollLeft, X_ViewPort_scrollY = X_ViewPort_rootElement.scrollTop || X_elmBody.scrollTop ]; } ), /** @@ -308,6 +321,22 @@ X[ 'ViewPort' ] = { return X_ViewPort_baseFontSize = X_Node_fontSizeNode[ '_rawObject' ].offsetHeight; }; return X_ViewPort_baseFontSize; + }, + + /** + * キーボードイベントを受け付ける + * @alias X.ViewPort.isActive + */ + 'isActive' : function(){ + return X_ViewPort_active; + }, + + /** + * 可視である。iframe 内のhtmlも + * @alias X.ViewPort.isVisible + */ + 'isVisible' : function(){ + return X_ViewPort_active; } }; @@ -337,7 +366,7 @@ X[ 'ViewPort' ] = { * http://sssslide.com/www.slideshare.net/hiroakiwakamatsu/ss-12718639 * * - * getBoundingClientRect で fontsize の調査 + * getBoundingClientRect で fontsize の調査 */ var X_ViewPort_resize = // iOS もループで回す,,,iOS3.1.3, iOS6 で確認 @@ -387,7 +416,7 @@ X[ 'ViewPort' ] = { }; X_TEMP.onDomContentLoaded = function(){ - var s, size, elmHtml, elmHead, elmBody, html, head, body; + var html, head, body; console.log( '> X_TEMP.onDomContentLoaded rs:' + X_ViewPort_readyState ); @@ -397,40 +426,32 @@ X[ 'ViewPort' ] = { // DOMContentLoaded の無いブラウザで X_TEMP.onDomContentLoaded への参照が残り続けるのを回避 X_TEMP.onDomContentLoaded && X_ViewPort_document[ 'unlisten' ]( 'DOMContentLoaded', X_TEMP.onDomContentLoaded ); delete X_TEMP.onDomContentLoaded; - - elmHtml = document.documentElement || - X_UA_DOM.W3C ? document.getElementsByTagName( 'html' )[ 0 ] : - X_UA_DOM.IE4 ? document.all.tags( 'html' )[ 0 ] : null; - - elmHead = - X_UA_DOM.W3C ? document.getElementsByTagName( 'head' )[ 0 ] : - X_UA_DOM.IE4 ? document.all.tags( 'head' )[ 0 ] : null; - elmBody = document.body; + X_elmBody = document.body; - X_ViewPort_rootElement = document.compatMode !== 'CSS1Compat' ? elmBody : elmHtml || elmBody; + X_ViewPort_rootElement = document.compatMode !== 'CSS1Compat' ? X_elmBody : X_elmHtml || X_elmBody; /** - * Node( documentElement ) + * X.Node( documentElement ) * @alias X.Doc.html * @type {Node} */ - X[ 'Doc' ][ 'html' ] = html = X_Node_html = elmHtml && Node( elmHtml )[ 'removeClass' ]( 'js-disabled' )[ 'addClass' ]( X_UA_classNameForHTML ); + X[ 'Doc' ][ 'html' ] = html = X_Node_html = X_elmHtml && Node( X_elmHtml )[ 'removeClass' ]( 'js-disabled' )[ 'addClass' ]( X_UA_classNameForHTML.split( '.' ).join( '_' ) ); html[ '_flags' ] |= X_NodeFlags_IN_TREE; /** - * Node( head ) + * X.Node( head ) * @alias X.Doc.head * @type {Node} */ - X[ 'Doc' ][ 'head' ] = head = X_Node_head = elmHead && Node( elmHead ); + X[ 'Doc' ][ 'head' ] = head = X_Node_head = X_elmHead && Node( X_elmHead ); /** - * Node( documentElement ) + * X.Node( body ) * @alias X.Doc.body * @type {Node} */ - X[ 'Doc' ][ 'body' ] = body = X_Node_body = Node( elmBody ); + X[ 'Doc' ][ 'body' ] = body = X_Node_body = Node( X_elmBody ); body[ 'parent ' ] = head[ 'parent' ] = html; html[ '_xnodes' ] = [ head, body ]; @@ -438,13 +459,12 @@ X[ 'ViewPort' ] = { html[ 'appendTo' ] = html[ 'prev' ] = html[ 'next' ] = html[ 'clone' ] = html[ 'remove' ] = html[ 'kill' ] = html[ 'create' ] = html[ 'createText' ] = html[ 'createAt' ] = html[ 'createTextAt' ] = html[ 'append' ] = html[ 'appendAt' ] = html[ 'empty' ] = html[ 'html' ] = html[ 'text' ] = html[ 'css' ] = html[ 'cssText' ] = - head[ 'appendTo' ] = head[ 'prev' ] = head[ 'next' ] = head[ 'clone' ] = head[ 'remove' ] = head[ 'kill' ] = + head[ 'appendTo' ] = head[ 'prev' ] = head[ 'clone' ] = head[ 'remove' ] = head[ 'kill' ] = head[ 'createText' ] = head[ 'createTextAt' ] = head[ 'empty' ] = head[ 'html' ] = head[ 'text' ] = head[ 'css' ] = head[ 'cssText' ] = - body[ 'appendTo' ] = body[ 'prev' ] = body[ 'next' ] = body[ 'clone' ] = body[ 'remove' ] = body[ 'kill' ] = new Function( 'return this' ); + body[ 'appendTo' ] = body[ 'next' ] = body[ 'clone' ] = body[ 'remove' ] = body[ 'kill' ] = new Function( 'return this' ); X_ViewPort[ 'listenOnce' ]( X_EVENT_PRE_INIT, function(){ X_ViewPort_readyState = X_EVENT_XTREE_READY; - if( X_TEMP.X_Dom_useBuilder ) X_TEMP.X_Dom_useBuilder = !!document.body.children.length; !X_TEMP.X_Dom_useBuilder && X_ViewPort[ 'asyncDispatch' ]( X_EVENT_XTREE_READY ); } ); @@ -464,39 +484,38 @@ X[ 'ViewPort' ] = { var size = X_ViewPort_getWindowSize(), // http://jsdo.it/imaya/kTYg - body = document.body, - defaultOverflow = document.body.style.overflow, + defaultOverflow = X_elmBody.style.overflow, w, h; X_ViewPort_width = size[ 0 ]; X_ViewPort_height = size[ 1 ]; - body.style.overflow = 'hidden'; - w = body.clientWidth; - h = body.clientHeight; + X_elmBody.style.overflow = 'hidden'; + w = X_elmBody.clientWidth; + h = X_elmBody.clientHeight; - body.style.overflow = 'scroll'; - w -= body.clientWidth; - h -= body.clientHeight; + X_elmBody.style.overflow = 'scroll'; + w -= X_elmBody.clientWidth; + h -= X_elmBody.clientHeight; - if( !w ) w = body.offsetWidth - body.clientWidth; - if( !h ) h = body.offsetHeight - body.clientHeight; - body.style.overflow = defaultOverflow; + if( !w ) w = X_elmBody.offsetWidth - X_elmBody.clientWidth; + if( !h ) h = X_elmBody.offsetHeight - X_elmBody.clientHeight; + X_elmBody.style.overflow = defaultOverflow; X_ViewPort_vScrollbarSize = w; X_ViewPort_hScrollbarSize = h; - if( h <= 0 ){ // ie6, ie11, firefox で 負の値が返る + if( h <= 0 ){ // ie6, ie11, firefox で 負の値が返る console.log( 'invalid hScrollbarSize: ' + h ); X_ViewPort_hScrollbarSize = w; }; // if( X_ViewPort_orientationchange ){ - X_EventDispatcher_systemListen( X_ViewPort, 'orientationchange', X_ViewPort_orientationchange ); + X_ViewPort[ 'listen' ]( 'orientationchange', X_ViewPort_orientationchange ); }; if( X_ViewPort_detectFontSize ){ - X_EventDispatcher_systemListen( X_ViewPort, 'resize', X_ViewPort_resize ); + X_ViewPort[ 'listen' ]( 'resize', X_ViewPort_resize ); X_Timer_add( 333, X_ViewPort_detectFontSize ); } else { X_Timer_add( 333, X_ViewPort_resize ); @@ -507,48 +526,52 @@ X[ 'ViewPort' ] = { X_ViewPort[ 'asyncDispatch' ]( X_ViewPort_readyState = X_EVENT_XDOM_READY ); } ); - X_ViewPort[ 'asyncDispatch' ]( X_EVENT_PRE_INIT ); - - - X_EventDispatcher_systemListen( X_ViewPort, [ 'beforeunload', 'unload' ] ); + if( X_TEMP.X_Dom_useBuilder ) X_TEMP.X_Dom_useBuilder = !!X_elmBody.children.length; + X_ViewPort[ 'asyncDispatch' ]( X_EVENT_PRE_INIT ); -//ブラウザの戻るボタンで戻ったときに呼ばれるイベントとかキャッシュとかそこらへんのこと -//http://d.hatena.ne.jp/koumiya/20080916/1221580149 + X_ViewPort[ 'listen' ]( [ 'beforeunload', 'unload' ] ); -console.log( '------------------->' ); + //ブラウザの戻るボタンで戻ったときに呼ばれるイベントとかキャッシュとかそこらへんのこと + //http://d.hatena.ne.jp/koumiya/20080916/1221580149 - if( document[ 'webkitHidden' ] !== undefined ){ - console.log( '--> has webkitvisibilitychange' ); - X_EventDispatcher_systemListen( X_ViewPort_document, 'webkitvisibilitychange', X_ViewPort ); - } else if( document[ 'hidden' ] !== undefined ){// iOS 7+ - console.log( '--> has visibilitychange' ); - X_EventDispatcher_systemListen( X_ViewPort_document, 'visibilitychange', X_ViewPort ); - document.onvisibilitychange = function(){ console.log( '!!!!!!!!!!!!!!!!' ) }; + X_ViewPort_document[ 'listen' ]( 'visibilitychange', X_ViewPort ); + } else + if( document[ 'webkitHidden' ] !== undefined ){ + X_ViewPort_document[ 'listen' ]( 'webkitvisibilitychange', X_ViewPort ); } else if( document[ 'msHidden' ] !== undefined ){ - X_EventDispatcher_systemListen( X_ViewPort_document, 'msvisibilitychange', X_ViewPort ); + X_ViewPort_document[ 'listen' ]( 'msvisibilitychange', X_ViewPort ); } else if( document[ 'mozHidden' ] !== undefined ){ - X_EventDispatcher_systemListen( X_ViewPort_document, 'mozvisibilitychange', X_ViewPort ); + // TODO Firefox + Android2 でブラウザにフォーカスが戻ったことが判らない... + X_ViewPort_document[ 'listen' ]( 'mozvisibilitychange', X_ViewPort ); }; if( window[ 'onpageshow' ] !== undefined ){ - console.log( '-------------------> pageshow, pagehide' ); - X_EventDispatcher_systemListen( X_ViewPort, [ 'pageshow', 'pagehide' ] ); + X_ViewPort[ 'listen' ]( [ 'pageshow', 'pagehide' ] ); }; if( document[ 'onfocusin' ] !== undefined ){ - console.log( '-------------------> focusin, focusout' ); // https://github.com/ai/visibilityjs/blob/master/lib/visibility.fallback.js - X_EventDispatcher_systemListen( X_ViewPort_document, [ 'focusin', 'focusout' ], X_ViewPort ); + X_ViewPort_document[ 'listen' ]( [ 'focusin', 'focusout' ], X_ViewPort ); + }; + + // TODO activeElement が無い対策 + if( !FocusUtility_docActiveElmSupport ){ + X_ViewPort[ 'listen' ]( 'focus', X_ViewPort_fixActiveElm ); }; - X_EventDispatcher_systemListen( X_ViewPort, [ 'focus', 'blur' ] ); + X_ViewPort[ 'listen' ]( [ 'focus', 'blur' ] ); return X_CALLBACK_UN_LISTEN; }; + function X_ViewPort_fixActiveElm( e ){ + // textNode を修正して elm にする処理は EventDisptcher に入っている + FocusUtility_fixActiveElm = e.target[ '_rawObject' ]; + }; + function X_ViewPort_getWindowSize(){ return X_UA[ 'IE' ] ? // Opera10.1 では ズーム時に表示領域のサイズが取れない! [ X_ViewPort_rootElement.clientWidth, X_ViewPort_rootElement.clientHeight ] : @@ -573,21 +596,21 @@ console.log( 'X.Dom dom:w3c=' + X_UA_DOM.W3C + ' ev:w3c=' + X_UA_EVENT.W3C ); if( X_UA_EVENT.W3C ){ X_ViewPort_document[ 'listenOnce' ]( 'DOMContentLoaded', X_TEMP.onDomContentLoaded ); } else -if( 6 <= X_UA[ 'IE' ] && X[ 'inHead' ] ){ +if( 6 <= X_UA[ 'IE' ] && X[ 'inHead' ] /* && !X_UA[ 'ieExeComError' ] */ ){ // standalone の除外 -> && !X_UA[ 'ieExeComError' ] // if this script in Head - //document.write( '' ); - //X_TEMP._script = document.getElementById( '__ie_onload' ); + //document.write( '' ); + //X_TEMP._script = document.getElementById( '__ieonload' ); // 上のコードはスタンドアローン版ie6でエラー - X_TEMP._script = document.createElement( '' ) ; - document.getElementsByTagName("head")[ 0 ].appendChild( X_TEMP._script ); - + X_TEMP._script = document.createElement( '' ); + X_elmHead.appendChild( X_TEMP._script ); + X_TEMP._script.onreadystatechange = function(){ var s = X_TEMP._script; if( s && s.readyState === 'complete' ){ s.onreadystatechange = X_emptyFunction; s.onreadystatechange = null; - s.parentNode.removeChild( s ); + s.removeNode( true ); delete X_TEMP._script; X_TEMP.onDomContentLoaded && X_TEMP.onDomContentLoaded(); };