OSDN Git Service

Version 0.6.165, fix Node.prototype.kill.
authoritozyun <itozyun@user.sourceforge.jp>
Tue, 23 Jun 2015 22:51:45 +0000 (07:51 +0900)
committeritozyun <itozyun@user.sourceforge.jp>
Tue, 23 Jun 2015 22:51:45 +0000 (07:51 +0900)
0.6.x/js/01_core/00_builtin.js
0.6.x/js/01_core/02_XUA.js
0.6.x/js/01_core/06_XString.js
0.6.x/js/01_core/13_XClass.js
0.6.x/js/01_core/21_XViewPort.js
0.6.x/js/02_dom/20_XNode.js
0.6.x/js/03_plugin/00_XPlugin.js
0.6.x/js/06_net/00_XNet.js

index 2582d1e..17b1dc3 100644 (file)
@@ -157,9 +157,9 @@ var _builtin_skipEncodeURI = (function(){
 })();\r
 \r
 // /[^!#$&-;=?-Z_a-z~]/g\r
-window.encodeURI || (window.encodeURI = function( x ){ return _builtin_encodeURI( x, 0 ); });\r
+window[ 'encodeURI' ] || (window[ 'encodeURI' ] = function( x ){ return _builtin_encodeURI( x, 0 ); });\r
 // /[^!'-*.0-9A-Z_a-z~-]/g\r
-window.encodeURIComponent || (window.encodeURIComponent = function( x ){ return _builtin_encodeURI( x, 1 ); });\r
+window[ 'encodeURIComponent' ] || (window[ 'encodeURIComponent' ] = function( x ){ return _builtin_encodeURI( x, 1 ); });\r
 \r
 function _builtin_encodeURI( x, kind ){\r
        var result = [],\r
@@ -227,8 +227,8 @@ function _builtin_decodeURI( x ){
        return result.join( '' );\r
 };\r
 \r
-window.decodeURI || (window.decodeURI = _builtin_decodeURI);\r
-window.decodeURIComponent || (window.decodeURIComponent = window.decodeURI);\r
+window[ 'decodeURI' ] || (window[ 'decodeURI' ] = _builtin_decodeURI);\r
+window[ 'decodeURIComponent' ] || (window[ 'decodeURIComponent' ] = window.decodeURI);\r
 \r
 \r
 /*\r
index 948f78b..61230c8 100644 (file)
@@ -719,7 +719,7 @@ if( X_UA[ 'IE' ] < 7 ){ // error @ NN7.2
                        X_UA[ 'ieExeComError' ] = eval( 'var a=1;try{document.execCommand&&document.execCommand("BackgroundImageCache",!1,!0)}catch(e){a=0}!a' );\r
                })();\r
        \r
-       X_UA[ 'ieExeComError' ] && alert( 'document.execCommand error!' );\r
+       //X_UA[ 'ieExeComError' ] && alert( 'document.execCommand error!' );\r
 };\r
 \r
 /*\r
index c9a9b60..58ec770 100644 (file)
@@ -142,7 +142,7 @@ function X_String_serialize_addParam( list, key, value ){
 };\r
 \r
 function X_String_serialize_buildParams( list, prefix, obj, traditional ) {\r
-       var name;\r
+       var name, i, l, v;\r
 \r
        if ( X_Type_isArray( obj ) ) {\r
                // Serialize array item.\r
index 2923520..9d92b55 100644 (file)
@@ -91,6 +91,11 @@ X_Class_CommonMethods =
                                X_EventDispatcher_unlistenAll( this );\r
                        };\r
 \r
+                       if( this[ 'instanceOf' ]( Node ) ){\r
+                               console.log( 'KILL : ' + this.call( 'outerHTML' ) );\r
+                               X_Node_onKill( this );\r
+                       };\r
+\r
                        timers = X_EventDispatcher_LAZY_TIMERS;\r
 \r
                        // asyncDispatch の削除\r
index 0cc12dd..2fe61fa 100644 (file)
@@ -39,7 +39,7 @@ X_ViewPort = X_Class_override(
                        
                        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;
                                        
@@ -227,7 +227,7 @@ X[ 'ViewPort' ] = {
  * http://sssslide.com/www.slideshare.net/hiroakiwakamatsu/javascript-14514208
  * 1. 傾き時の画面サイズ取得ー 対処方法の例
  * (1)ー? タイマーを使って、画面サイズ取得の タイミングを少しだけ遅延させる
- * window.onorientationchange = function() { setTimeout(function() { alert("W: " + window.innerWidth + ", H: " + window.innerHeight); }, 200); }
+ * window.onorientationchange = function() { setTimeout(function() { alert('W: ' + window.innerWidth + ', H: ' + window.innerHeight); }, 200); }
  * 横に傾けた時、正常に横向け時の 幅と高さが取得できている ただし、端末によってはうまく取得できな い場合がある(Galaxy S IIIとか・・・) 7 
  * 
  * http://sssslide.com/www.slideshare.net/hiroakiwakamatsu/ss-12718639
@@ -331,12 +331,12 @@ X[ 'ViewPort' ] = {
                        body[ 'parent ' ] = head[ 'parent' ] = html;
                        html[ '_xnodes' ] = [ head, body ];
                        
-                       html[ 'appendTo' ] = html[ 'prev' ] = html[ 'next' ] = html[ 'clone' ] = html[ 'remove' ] = html[ 'destroy' ] =
+                       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[ 'destroy' ] =
+                       head[ 'appendTo' ] = head[ 'prev' ] = head[ 'next' ] = 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[ 'destroy' ] = new Function( 'return this' );
+                       body[ 'appendTo' ] = body[ 'prev' ] = 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;
@@ -459,8 +459,13 @@ if( X_UA_EVENT.W3C ){
 } else
 if( 6 <= X_UA[ 'IE' ] && X[ 'inHead' ] ){
        // if this script in Head
-       document.write( "<script id=__ie_onload defer src=javascript:void(0)><\/script>" );
-       X_TEMP._script = document.getElementById( "__ie_onload" );
+       //document.write( '<script id="__ie_onload" defer src="javascript:void(0)"></script>' );
+       //X_TEMP._script = document.getElementById( '__ie_onload' );
+       
+       // 上のコードはスタンドアローン版ie6でエラー
+    X_TEMP._script = document.createElement( '<script id="__ie_onload" defer src="javascript:void(0)"></script>' ) ;
+    document.getElementsByTagName("head")[ 0 ].appendChild( X_TEMP._script );
+    
        X_TEMP._script.onreadystatechange = function(){
                var s = X_TEMP._script;
                if( s && s.readyState === 'complete' ){
index e0aa707..04f01e2 100644 (file)
@@ -221,8 +221,6 @@ var Node = X[ 'Node' ] = X_EventDispatcher[ 'inherits' ](
                        };
                        this[ '_flags' ] |= X_NodeFlags_EXIST;
                        X_Node_CHASHE[ this[ '_uid' ] = uid ] = this;
-                       
-                       X_EventDispatcher_systemListen( this, X_EVENT_BEFORE_KILL_INSTANCE, X_Node_onBeforeKill );
                },
                
                'width'          : X_Node_width,
@@ -804,33 +802,44 @@ function X_Node_empty(){
        return this;
 };
 
-function X_Node_onBeforeKill( e ){
-       var xnodes = this[ '_xnodes' ], i, elm;
+function X_Node_onKill( that ){
+       var parent = that.parent,
+               xnodes = that[ '_xnodes' ], i, elm;
        
-       if( ( this[ '_flags' ] & X_NodeFlags_EXIST ) === 0 ) return X_Callback_NONE;
+       if( ( that[ '_flags' ] & X_NodeFlags_EXIST ) === 0 ) return;
        
-       elm = this[ '_rawObject' ] || X_UA_DOM.IE4 && X_Node__ie4getRawNode( this );
-       elm && this[ '_listeners' ] && X_EventDispatcher_unlistenAll( this ); // イベントの退避
+       parent && parent[ '_xnodes' ].splice( parent[ '_xnodes' ].indexOf( that ), 1 );
+
+       elm = that[ '_rawObject' ] || X_UA_DOM.IE4 && X_Node__ie4getRawNode( that );
+       // elm && that[ '_listeners' ] && X_EventDispatcher_unlistenAll( that ); // イベントの退避
 
        if( xnodes && ( i = xnodes.length ) ){
                for( ; i; ){
-                       X_Node_onBeforeKill.call( xnodes[ --i ] );
+                       xnodes[ --i ][ 'kill' ]();
                };
        };
 
-       delete X_Node_CHASHE[ this[ '_uid' ] ];
-
-       if( e ){
-               this[ 'remove' ]();
-               if( X_Node_reserveRemoval[ X_Node_reserveRemoval.length - 1 ] === this ){
-                       this[ '_flags' ] &= ~X_NodeFlags_EXIST;
-                       return X_Callback_PREVENT_DEFAULT;              
-               };              
+       delete X_Node_CHASHE[ that[ '_uid' ] ];
+// remove _xnodes
+       if( X_UA_DOM.IE4 ){
+               if( elm ){
+                       X_Node_reserveRemoval[ X_Node_reserveRemoval.length ] = elm;
+                       X_Node_reserveUpdate();                 
+               } else
+               if( !that[ '_tag' ] && ( parent[ '_flags' ] & X_NodeFlags_IE4_FIXED ) === 0 ){
+                       parent[ '_flags' ] |= X_NodeFlags_IE4_DIRTY_CHILDREN;
+               };
+       } else {
+               if( elm && elm.parentNode && elm.parentNode.tagName ){
+                       X_Node_reserveRemoval[ X_Node_reserveRemoval.length ] = elm;
+                       X_Node_reserveUpdate();         
+               };
        };
-       return X_Callback_NONE;
 };
 
 
+
+
 /**
  * 要素を子以下に持つか?調べる。
  * @alias Node.prototype.contains
@@ -1141,7 +1150,7 @@ function X_Node_text( text ){
  */
 function X_Node_call( name /*, opt_args... */ ){
        var l = arguments.length - 1,
-               raw, func, args, params, i;
+               v, raw, func, args, params, i;
 
        switch( name ){
                case 'nodeType' :
@@ -1230,7 +1239,7 @@ function X_Node_reserveUpdate(){
 var X_Node_updateReservedByReleaseGPU = false;
 
 function X_Node_startUpdate( time ){
-       var removal, i, xnode;
+       var removal, i, xnodeOrElm;
        
        if( !X_Node_updateTimerID || X_ViewPort_readyState < X_EVENT_INIT ){
                return;
@@ -1248,10 +1257,23 @@ function X_Node_startUpdate( time ){
 
        if( i = removal.length ){
                for( ; i; ){
-                       xnode = removal[ --i ];
+                       xnodeOrElm = removal[ --i ];
                        // TODO GPU レイヤーの子の場合、remove をスキップする。 非GPU レイヤーへ apppend される場合、clone する?
-                       X_Node__actualRemove( xnode );
-                       ( xnode[ '_flags' ] & X_NodeFlags_EXIST ) === 0 && xnode[ 'kill' ]();
+                       if( !xnodeOrElm[ 'instanceOf' ] ){
+                               if( X_UA_DOM.IE4 ){
+                                       xnodeOrElm.removeAttribute( 'id' ); // ?
+                                       xnodeOrElm.outerHTML = ''; // xnodeOrElm.remove() ?
+                               } else {
+                                       if( !X_UA[ 'MacIE' ] ){
+                                               // elm.parentNode.tagName for ie7
+                                               xnodeOrElm.parentNode && xnodeOrElm.parentNode.tagName && xnodeOrElm.parentNode.removeChild( xnodeOrElm );
+                                       } else {
+                                               xnodeOrElm.parentNode && xnodeOrElm.parentNode.tagName && X_TEMP._fixed_remove( xnodeOrElm, that );
+                                       };
+                               };
+                       } else {
+                               X_Node__actualRemove( xnodeOrElm );
+                       };
                };
                removal.length = 0;
        };
@@ -1585,7 +1607,8 @@ var X_Node__updateRawNode =
                                        switch( that[ '_tag' ] + k ){
                                                case 'TEXTAREAvalue' :
                                                        // IETester 5.5 ではエラーが出なかった.MultipulIE5.5 ではエラーが出たので
-                                                       if( !X_UA[ 'MacIE' ] && X_UA[ 'IE5x' ] ){
+                                                       // MultipleIE6 でもここを通す。X_UA[ 'ieExeComError' ] の場合 MultipleIE6
+                                                       if( ( !X_UA[ 'MacIE' ] && X_UA[ 'IE5x' ] ) || ( X_UA[ 'ieExeComError' ] && X_UA[ 'IE6' ] ) ){
                                                                elm.firstChild ?
                                                                        ( elm.firstChild.data = v || '' ) :
                                                                        elm.appendChild( document.createTextNode( v || '' ) );
@@ -1884,7 +1907,7 @@ var X_Node__actualRemove =
 
                        elm.removeAttribute( 'id' ); // ?
                        //document.all[ that[ '_id' ] || ( 'ie4uid' + that[ '_uid' ] ) ] = null; // MacIE5 でエラー
-                       if( !isChild ) elm.outerHTML = '';
+                       if( !isChild ) elm.outerHTML = ''; // elm.remove() ?
                        delete that[ '_rawObject' ];
                }) :
                (function(){});
index a7858e4..aa9daf9 100644 (file)
@@ -1,3 +1,24 @@
+/*
+ * VBS
+ */
+
+if( false && 5 <= X_UA[ 'IE' ] && X_UA[ 'IE' ] < 11 ){
+       (function(){
+
+                var script = document.createElement( "script" ) ;
+                script[ "type" ] = "text/vbscript" ;
+                script.text = [
+                    "Function vba_IEBinaryToArrayBytes()\n" ,
+                    "  vba_IEBinaryToArrayBytes = 1\n" ,
+                    "End Function\n"
+                    ].join( "" ) ;
+                document.getElementsByTagName("head")[ 0 ].appendChild( script ) ;
+               
+               // alert( vba_IEBinaryToArrayBytes() );
+       })();
+       
+};
+
 
 /*
  * Flash Player 10 バージョン判別チェックリスト
index fa1a6d4..2dc4432 100644 (file)
@@ -235,10 +235,10 @@ function X_NET_proxyDispatch( e ){
        switch( e.type ){\r
                case X_EVENT_KILL_INSTANCE :\r
                        if( this === X_NET_currentQueue && X_NET_completePhase ){\r
-                               if( X_NET_completePhase === 1 )\r
+                               if( X_NET_completePhase === 1 ){\r
                                        this[ 'unlisten' ]( X_EVENT_COMPLETE, X_NET_proxyDispatch )\r
                                                [ 'dispatch' ]( X_EVENT_COMPLETE );\r
-                               this.kill();//test\r
+                               };\r
                                X_NET_shiftQueue();\r
                                X_Pair_release( this );\r
                                X_NET_completePhase = 0;\r