OSDN Git Service

Version 0.6.106, bugfix for X.EventDispatcher, cleanup X.Node, Image JSONP for Opera1...
authoritozyun <itozyun@user.sourceforge.jp>
Thu, 16 Oct 2014 07:56:31 +0000 (16:56 +0900)
committeritozyun <itozyun@user.sourceforge.jp>
Thu, 16 Oct 2014 07:56:31 +0000 (16:56 +0900)
13 files changed:
0.6.x/js/01_core/13_XEventDispatcher.js
0.6.x/js/01_core/16_XViewPort.js
0.6.x/js/02_dom/02_XNode.js
0.6.x/js/02_dom/03_XDomEvent.js
0.6.x/js/02_dom/04_XBoxModel.js
0.6.x/js/02_dom/05_XNodeAttr.js
0.6.x/js/02_dom/06_XNodeCSS.js
0.6.x/js/02_dom/08_XNodeSelector.js
0.6.x/js/05_util/01_XNinjaIframe.js
0.6.x/js/06_net/02_XNetJSONP.js
0.6.x/js/06_net/04_XNetImage.js
0.6.x/js/07_audio/01_XHTML5Audio.js
0.6.x/js/07_audio/02_XSilverlightAudio.js

index 19a52af..7ff83b3 100644 (file)
@@ -57,6 +57,7 @@ X.EventDispatcher =
             * @memberof X.EventDispatcher\r
             */\r
 \r
+               // TODO _rawObjectType EventTarget, XHR, Silverlight, ...\r
                /**\r
                 * イベントリスナをイベント名(string)や数値(1~,フレームワーク内で定義)をキーとするArrayで記憶します。\r
                 * Arrayには、{k:種類,x:コンテキスト(thisObject),f:関数,s:サプリメントする引数の配列} というハッシュ、または関数が蓄えられています。\r
@@ -333,6 +334,8 @@ function X_EventDispatcher_dispatch( e ){
 function X_EventDispatcher_listen( type, opt_arg1, opt_arg2, opt_arg3 ){\r
        var list = this._listeners,\r
                i, raw, add, f;\r
+\r
+       if( !type ) return this;\r
        \r
        if( this._dispatching ){\r
                if( !this._reserves ) this._reserves = [];\r
@@ -350,7 +353,7 @@ function X_EventDispatcher_listen( type, opt_arg1, opt_arg2, opt_arg3 ){
        raw = this._rawObject || X_UA_DOM.IE4 && X_Node__ie4getRawNode( this );\r
        add = raw && ( !list || !list[ type ] ) && X.Type.isString( type );\r
        \r
-       if( this.listening( type, opt_arg1, opt_arg2, opt_arg3 ) ) return this;\r
+       if( this.listening( type, opt_arg1 || this, opt_arg2, opt_arg3 ) ) return this;\r
 \r
        if( !list ) list = this._listeners = {};\r
        if( !( list = list[ type ] ) ) list = this._listeners[ type ] = [];\r
@@ -374,6 +377,8 @@ function X_EventDispatcher_systemListen( that, type, opt_arg1, opt_arg2, opt_arg
        X_EventDispatcher_lock = false;\r
 };\r
 \r
+// TODO this.listen(type) は this リスナの登録なのに、this.unlisten(type)は全てのtypeの削除、と不一致\r
+\r
 /**\r
  * \r
  * @this {X.EventDispatcher}\r
index 5161c23..6eb62df 100644 (file)
@@ -12,7 +12,7 @@ var X_ViewPort_readyState,
        X_Dom_detectFontSize = !( X_UA.IE < 9 || X_UA.iOS ) && function(){
                        var size = X_Node_fontSizeNode._rawObject.offsetHeight;
                        if( X_ViewPort_baseFontSize !== size ){
-                               X_ViewPort_baseFontSize && X_ViewPort.asyncDispatch( { type : X.Event.BASE_FONT_RESIZED, fontSize : size, w : X_ViewPort_width, h : X_ViewPort_height } );
+                               X_ViewPort_baseFontSize && X_ViewPort.asyncDispatch( X.Event.BASE_FONT_RESIZED );
                                X_ViewPort_baseFontSize = size;
                        };
        },
@@ -25,6 +25,8 @@ var X_ViewPort_readyState,
        },
        
        X_ViewPort_document = new X.EventDispatcher( document ),
+       
+       X_ViewPort_postMessageAccessKey = Math.random() * 10000 | 0,
 
 X_ViewPort = X_Class_override(
        new X.EventDispatcher( window ),
@@ -34,34 +36,51 @@ X_ViewPort = X_Class_override(
                        var href;
                        switch( e.type ){
                                case '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;
                                        
                                        return X_ViewPort.dispatch( X.Event.BEFORE_UNLOAD );
+                                       
                                case 'unload' :
                                        X_ViewPort.dispatch( X.Event.UNLOAD );
+                               //alert('unload');
+                                       X_ViewPort_document.kill();
+                                       this.kill();
                                        
-                                       X_ViewPort.unlisten();
-                                       X_ViewPort_document.unlisten();
-                                       X_Node__actualRemove( X_Node_html, true );
+                                       //X_System.dispatch( X.Event.SHUT_DOWN );
                                        break;
+
                                case 'visibilitychange' :
-                                       X_ViewPort.dispatch( { type : ( X_ViewPort_active = document[ 'hidden' ] ) ? X.Event.VIEW_DEACTIVATE : X.Event.VIEW_ACTIVATE } );
+                                       X_ViewPort.asyncDispatch( ( X_ViewPort_active = document[ 'hidden' ] ) ? X.Event.VIEW_DEACTIVATE : X.Event.VIEW_ACTIVATE );
                                        break;
                                case 'webkitvisibilitychange' :
-                                       X_ViewPort.dispatch( { type : ( X_ViewPort_active = document[ 'webkitHidden' ] ) ? X.Event.VIEW_DEACTIVATE : X.Event.VIEW_ACTIVATE } );
+                                       X_ViewPort.asyncDispatch( ( X_ViewPort_active = document[ 'webkitHidden' ] ) ? X.Event.VIEW_DEACTIVATE : X.Event.VIEW_ACTIVATE );
                                        break;
+                                       
                                case 'pageshow' :
                                case 'focus' :
-                                       X_ViewPort_active = true;
-                                       X_ViewPort.dispatch( X.Event.VIEW_ACTIVATE );
+                                       if( !X_ViewPort_active ){
+                                               X_ViewPort_active = true;
+                                               X_ViewPort.asyncDispatch( X.Event.VIEW_ACTIVATE );                                              
+                                       };
                                        break;
+
                                case 'pagehide' :
                                case 'blur' :
-                                       X_ViewPort_active = false;
-                                       X_ViewPort.dispatch( X.Event.VIEW_DEACTIVATE );
+                                       if( X_ViewPort_active ){
+                                               X_ViewPort_active = false;
+                                               X_ViewPort.asyncDispatch( X.Event.VIEW_DEACTIVATE );                                            
+                                       };
+                                       break;
+                               
+                               // TODO
+                               case 'message' :
+                                       if( e.origin !== X.URL.BASE_URL ){
+                                               
+                                       } else {
+                                               e.data;
+                                       };
                                        break;
                        };
                }
@@ -77,8 +96,9 @@ X.ViewPort = {
                        /*
                         * X.Event.XDOM_READY 以後に listen した場合の対策
                         */
-                       X_ViewPort.asyncDispatch( { type : type, w : X_ViewPort_width, h : X_ViewPort_height } );
+                       X_ViewPort.asyncDispatch( type );
                };
+               // ie8-では keydown -> documentへ
                type && arg1 && X_ViewPort.listen( type, arg1, arg2, arg3 );
                return X.ViewPort;
        },
@@ -89,7 +109,7 @@ X.ViewPort = {
                        /*
                         * X.Event.XDOM_READY 以後に listen した場合の対策
                         */
-                       X_ViewPort.asyncDispatch( { type : type, w : X_ViewPort_width, h : X_ViewPort_height } );
+                       X_ViewPort.asyncDispatch( type );
                };
                type && arg1 && X_ViewPort.listenOnce( type, arg1, arg2, arg3 );
                return X.ViewPort;
@@ -132,7 +152,7 @@ X.ViewPort = {
        //http://onozaty.hatenablog.com/entry/20060803/p1
        // Safari2.0.4では標準・互換どちらも document.body
                
-               X_Node_body._updateTimerID && X_Node_startUpdate();
+               X_Node_updateTimerID && X_Node_startUpdate();
                /*X_UA.Opera ?
                        ( document.documentElement && document.documentElement.clientWidth ?
                                new Function( 'return[document.documentElement.clientWidth,document.documentElement.clientHeight]' ) :
@@ -147,16 +167,16 @@ X.ViewPort = {
        getScrollPosition :
                window.pageXOffset !== undefined ?
                        ( function(){
-                               X_Node_body._updateTimerID && X_Node_startUpdate();
+                               X_Node_updateTimerID && X_Node_startUpdate();
                                return[ window.pageXOffset, window.pageYOffset ];
                        } ) :
                window.scrollLeft  !== undefined ?
                        ( function(){
-                               X_Node_body._updateTimerID && X_Node_startUpdate();
+                               X_Node_updateTimerID && X_Node_startUpdate();
                                return[ window.scrollLeft, window.scrollTop ];
                        } ) :
                        ( function(){
-                               X_Node_body._updateTimerID && X_Node_startUpdate();
+                               X_Node_updateTimerID && X_Node_startUpdate();
                                // body は Safari2-
                                return[ X_ViewPort_rootElement.scrollLeft || document.body.scrollLeft, X_ViewPort_rootElement.scrollTop || document.body.scrollTop ];
                        } ),
@@ -166,7 +186,7 @@ X.ViewPort = {
        },
        
        getBaseFontSize : function(){
-               if( X_Node_body._updateTimerID ){
+               if( X_Node_updateTimerID ){
                        X_Node_startUpdate();
                        return X_ViewPort_baseFontSize = X_Node_fontSizeNode._rawObject.offsetHeight;
                };
@@ -219,7 +239,7 @@ X.ViewPort = {
                                        
                                        size = X_Node_fontSizeNode._rawObject.offsetHeight;
                                        if( X_ViewPort_baseFontSize !== size ){
-                                               X_ViewPort_baseFontSize && X_ViewPort.asyncDispatch( { type : X.Event.BASE_FONT_RESIZED, fontSize : size, w : X_ViewPort_width, h : X_ViewPort_height  } );
+                                               X_ViewPort_baseFontSize && X_ViewPort.asyncDispatch( X.Event.BASE_FONT_RESIZED );
                                                X_ViewPort_baseFontSize = size;
                                        };
                                        
@@ -240,7 +260,7 @@ X.ViewPort = {
                        } else {
                                console.log( '-- detectFinishResizing : ' + X_Timer_now() );
                                
-                               X_ViewPort.asyncDispatch( { type : X.Event.VIEW_RESIZED, fontSize : X_ViewPort_baseFontSize, w : X_ViewPort_width, h : X_ViewPort_height } );
+                               X_ViewPort.asyncDispatch( X.Event.VIEW_RESIZED );
                                X_ViewPort_lock = false;
                                if( X_ViewPort_orientationFlag ){
                                        X_ViewPort_orientationFlag = false;
@@ -336,11 +356,11 @@ X.ViewPort = {
                                
                                //
                                if( X_Dom_orientationchange ){
-                                       X_ViewPort.listen( 'orientationchange', X_Dom_orientationchange );
+                                       X_EventDispatcher_systemListen( X_ViewPort, 'orientationchange', X_Dom_orientationchange );
                                };
                                
                                if( X_Dom_detectFontSize ){
-                                       X_ViewPort.listen( 'resize', X_ViewPort_resize );
+                                       X_EventDispatcher_systemListen( X_ViewPort, 'resize', X_ViewPort_resize );
                                        X.Timer.add( 333, X_Dom_detectFontSize );
                                } else {
                                        X.Timer.add( 333, X_ViewPort_resize );
@@ -354,25 +374,22 @@ X.ViewPort = {
 
                        console.log( X_ViewPort.asyncDispatch( X_TEMP.SYSTEM_EVENT_PRE_INIT ) );        
 
-                       X_ViewPort
-                               .listen( 'beforeunload', X_ViewPort )
-                               .listenOnce( 'unload', X_ViewPort );
+
+                       X_EventDispatcher_systemListen( X_ViewPort, [ 'beforeunload', 'unload' ] );
 
 //ブラウザの戻るボタンで戻ったときに呼ばれるイベントとかキャッシュとかそこらへんのこと
 //http://d.hatena.ne.jp/koumiya/20080916/1221580149
 
                        if( document[ 'hidden' ] !== undefined ) {// iOS 7+
-                               X_ViewPort_document.listen( 'visibilitychange', X_ViewPort );
+                               X_EventDispatcher_systemListen( X_ViewPort_document, 'visibilitychange', X_ViewPort );
                        } else
                        if( document[ 'webkitHidden' ] !== undefined ) {
-                               X_ViewPort_document.listen( 'webkitvisibilitychange', X_ViewPort );
+                               X_EventDispatcher_systemListen( X_ViewPort_document, 'webkitvisibilitychange', X_ViewPort );
                        } else
                        if( X_UA.iOS && window[ 'onpageshow' ] !== undefined ) {
-                               X_ViewPort.listen( 'pageshow', X_ViewPort )
-                                                       .listen( 'pagehide', X_ViewPort );      
+                               X_EventDispatcher_systemListen( X_ViewPort, [ 'pageshow', 'pagehide' ] );
                        } else {
-                               X_ViewPort.listen( 'focus', X_ViewPort )
-                                                       .listen( 'blur', X_ViewPort );
+                               X_EventDispatcher_systemListen( X_ViewPort, [ 'focus', 'blur' ] );
                        };
 
                        return X_Callback_UN_LISTEN;
index 233ee62..22c8f03 100644 (file)
@@ -4,9 +4,9 @@ var
                CHILD_IS_DIRTY   :  1,\r
                ID               :  2, // width, height, x, y\r
                CONTENT          :  4, // width, height, x, y textNode の内容\r
-               CLASSNAME        :  8, // _getCharSize, width, height, x, y\r
-               ATTR             : 16, // _getCharSize, width, height, x, y\r
-               CSS              : 32, // _getCharSize, width, height, x, y\r
+               CLASSNAME        :  8, // X_Node_CSS_getCharSize, width, height, x, y\r
+               ATTR             : 16, // X_Node_CSS_getCharSize, width, height, x, y\r
+               CSS              : 32, // X_Node_CSS_getCharSize, width, height, x, y\r
                IE_FILTER        : X_UA.IE < 9 && !X_UA.MacIE ? 64 : 0,\r
                UNKNOWN_TAG_FIX  : 128,\r
                IE4_TEXTNODE_FIX : 256\r
@@ -15,8 +15,8 @@ var
        X_Node_State = {\r
                DESTROYED          : 0,\r
                EXIST              : 1, // XNODE_EXIDT, ELEMENT_EXIST\r
-               BELONG_TREE        : 2, // HAS_PARENT, BELONG_TREE_XNODE, BELONG_TREE_ELEMENT\r
-               DISPLAY_NONE       : 4, // VISIVILITY_HIDDEN & DISPALY_NONE\r
+               BELONG_TREE        : 2, // HAS_PARENT, HAS_PARENT_ACTUAL, BELONG_TREE, BELONG_TREE_ACTUAL\r
+               DISPLAY_NONE       : 4, // VISIVILITY_HIDDEN(opacity0), DISPALY_NONE\r
                DISPLAY_BLOCK      : 8, // remove\r
                DISPLAY_INLINE     : 16,// remove\r
                POSITION_ABSOLUTE  : 32,\r
@@ -46,11 +46,13 @@ var
        \r
        X_Node_useDocumentFragment = document.createDocumentFragment && ( !X_UA.IE || 5.5 <= X_UA.IE ) && document.createDocumentFragment(),\r
        \r
-       X_Node_newByTag  = false,\r
+       X_Node_newByTag      = false,\r
        \r
-       X_Node_newByText = false,\r
+       X_Node_newByText     = false,\r
        \r
-       X_Node_outerXNode = null,\r
+       X_Node_outerXNode    = null,\r
+       \r
+       X_Node_updateTimerID = 0,\r
 /*\r
  * Node( rawElement | rawTextnode | htmlString | textString )\r
  */    \r
@@ -960,21 +962,20 @@ function X_Node_each( func /*, opt_args */ ){
  */\r
        \r
 function X_Node_reserveUpdate(){\r
-       var root = X_Node_body;\r
-       if( root && !root._updateTimerID ) root._updateTimerID = X.Timer.requestFrame( X_Node_startUpdate );\r
+       if( !X_Node_updateTimerID ) X_Node_updateTimerID = X.Timer.requestFrame( X_Node_startUpdate );\r
 };\r
 \r
 function X_Node_startUpdate(){\r
        var removal, i, xnode, tmp;\r
-       if( X_ViewPort_readyState < X_TEMP.SYSTEM_EVENT_INIT ){\r
-               return;\r
-       };\r
-       if( X_Node_body._updateTimerID ){\r
-               X.Timer.cancelFrame( X_Node_body._updateTimerID );\r
-               X_Node_body._updateTimerID = 0;\r
-       } else {\r
+       \r
+       if( !X_Node_updateTimerID || X_ViewPort_readyState < X_TEMP.SYSTEM_EVENT_INIT ){\r
                return;\r
        };\r
+\r
+       X.Timer.cancelFrame( X_Node_updateTimerID );\r
+       X_Node_updateTimerID = 0;\r
+\r
+\r
        // このイベントでサイズを取ると無限ループに\r
        // X_ViewPort._listeners && X_ViewPort._listeners[ X.Event.BEFORE_UPDATE ] && X_ViewPort.dispatch( X.Dom.Event.BEFORE_UPDATE );\r
 \r
@@ -1033,9 +1034,6 @@ var X_Node__commitUpdate =
                                                frg.appendChild( X_Node__actualCreate( xnodes[ i ], true ) );\r
                                        };\r
                                        elm.appendChild( frg );\r
-                                       for( i = 0; i < l; ++i ){\r
-                                               X_Node__actualCreate( xnodes[ i ], true );\r
-                                       };\r
                                } else {*/\r
                                        for( ; l; ){\r
                                                next = X_Node__commitUpdate( xnodes[ --l ], elm, next );\r
@@ -1123,6 +1121,7 @@ var X_Node__updateRawNode =
                                        return;\r
                                };\r
                        };\r
+                       \r
                        // style\r
                        // TODO display:none の場合、更新をスキップ\r
                        if( that._dirty & X_Node_Dirty.CSS ){\r
@@ -1208,9 +1207,9 @@ var X_Node__updateRawNode =
                                for( k in attrs ){\r
                                        ( v = attrs[ k ] ) === undefined ?\r
                                                elm.removeAttribute( rename[ k ] || k ) :\r
-                                       that._tag === 'TEXTAREA' && k === 'value' ?\r
-                                               ( elm.innerText = v ) :\r
-                                               elm.setAttribute( rename[ k ] || k, X_Node_Attr_noValue[ k ] ? k : v ); // TODO X_Node_Attr_noValue[ k ] ? k : v\r
+                                       //that._tag === 'TEXTAREA' && k === 'value' ?\r
+                                       //      ( elm.innerText = v ) :\r
+                                               elm.setAttribute( rename[ k ] || k, X_Node_Attr_noValue[ k ] ? k : v );\r
                                };\r
                                delete that._newAttrs;\r
                        };\r
@@ -1398,9 +1397,9 @@ var X_Node__actualRemove =
                        };\r
 \r
                        if( !elm ) return;\r
-                       that._xnodeType === 1 && X_EventDispatcher_toggleAllEvents( that, false );// イベントの退避\r
-                       // elm.parentNode.tagName for ie7\r
+                       that._listeners && X_EventDispatcher_toggleAllEvents( that, false );// イベントの退避\r
                        if( !X_UA.MacIE ){\r
+                               // elm.parentNode.tagName for ie7 -> that.state & BELONG_TREE_ACTUAL\r
                                !isChild && elm.parentNode && elm.parentNode.tagName && elm.parentNode.removeChild( elm );\r
                        } else {\r
                                !isChild && elm.parentNode && elm.parentNode.tagName && X_TEMP._fixed_remove( elm, that );\r
@@ -1418,7 +1417,7 @@ var X_Node__actualRemove =
                        };\r
 \r
                        if( !elm ) return;\r
-                       that._xnodeType === 1 && X_EventDispatcher_toggleAllEvents( that, false );// イベントの退避\r
+                       that._listeners && X_EventDispatcher_toggleAllEvents( that, false );// イベントの退避\r
                        \r
                        if( X_Node_Attr_HAS_VALUE[ that._tag ] && ( !that._newAttrs || !X_Object_inObject( 'value', that._newAttrs ) ) ){\r
                                that._attrs.value = elm.value;\r
@@ -1429,3 +1428,6 @@ var X_Node__actualRemove =
                        delete that._rawObject;\r
                }) :\r
                (function(){});\r
+\r
+X_ViewPort.listenOnce( X.Event.UNLOAD, X_Node__actualRemove, [ X_Node_html, true ] );\r
+\r
index c221472..540ed81 100644 (file)
@@ -274,6 +274,9 @@ if( !X_UA.IE || 9 <= X_UA.IE ){
                };\r
                this.buttons     = e.button;\r
        \r
+               this.deltaX      = 0;\r
+               this.deltaY      = e.wheelDelta / -120; \r
+       \r
                if( type = X_Event_toPointer[ originalType ] ){\r
                        this.type          = type;\r
                        this.clientX       = e.clientX;\r
@@ -297,9 +300,6 @@ if( !X_UA.IE || 9 <= X_UA.IE ){
                        //      this.offsetX       = e.x - e.srcElement.offsetLeft; // e.x はイベント発生要素の親要素を基準にした座標。\r
                        //      this.offsetY       = e.y - e.srcElement.offsetTop;      \r
                        //};\r
-\r
-                       this.deltaX      = 0;\r
-                       this.deltaY      = e.wheelDelta / -120;\r
                        \r
                        this.pointerId     = 1;\r
                        this.radiusX       = 0;\r
index 639ed3a..f7fa20b 100644 (file)
@@ -53,7 +53,7 @@ Node.prototype.width = function(){
                console.log( 'xnode.width() : no parent' );\r
                return 0;\r
        };\r
-       X_Node_body._updateTimerID && X_Node_startUpdate();\r
+       X_Node_updateTimerID && X_Node_startUpdate();\r
        if( !this._root ){\r
                console.log( 'xnode.width() : not belong tree.' );\r
                return 0;\r
@@ -75,7 +75,7 @@ Node.prototype.height = function(){
                console.log( 'xnode.height() : no parent' );\r
                return 0;\r
        };\r
-       X_Node_body._updateTimerID && X_Node_startUpdate();\r
+       X_Node_updateTimerID && X_Node_startUpdate();\r
        if( !this._root ){\r
                console.log( 'xnode.height() : not belong tree.' );\r
                return 0;\r
@@ -97,7 +97,7 @@ Node.prototype.clientWidth = function(){
                console.log( 'xnode.width() : no parent' );\r
                return 0;\r
        };\r
-       X_Node_body._updateTimerID && X_Node_startUpdate();\r
+       X_Node_updateTimerID && X_Node_startUpdate();\r
        if( !this._root ){\r
                console.log( 'xnode.width() : not belong tree.' );\r
                return 0;\r
@@ -119,7 +119,7 @@ Node.prototype.clientHeight = function(){
                console.log( 'xnode.height() : no parent' );\r
                return 0;\r
        };\r
-       X_Node_body._updateTimerID && X_Node_startUpdate();\r
+       X_Node_updateTimerID && X_Node_startUpdate();\r
        if( !this._root ){\r
                console.log( 'xnode.height() : not belong tree.' );\r
                return 0;\r
@@ -141,7 +141,7 @@ Node.prototype.scrollWidth = function(){
                console.log( 'xnode.width() : no parent' );\r
                return 0;\r
        };\r
-       X_Node_body._updateTimerID && X_Node_startUpdate();\r
+       X_Node_updateTimerID && X_Node_startUpdate();\r
        if( !this._root ){\r
                console.log( 'xnode.width() : not belong tree.' );\r
                return 0;\r
@@ -163,7 +163,7 @@ Node.prototype.scrollHeight = function(){
                console.log( 'xnode.height() : no parent' );\r
                return 0;\r
        };\r
-       X_Node_body._updateTimerID && X_Node_startUpdate();\r
+       X_Node_updateTimerID && X_Node_startUpdate();\r
        if( !this._root ){\r
                console.log( 'xnode.height() : not belong tree.' );\r
                return 0;\r
@@ -185,7 +185,7 @@ Node.prototype.scrollLeft = function(){
                console.log( 'xnode.scrollLeft() : no parent' );\r
                return 0;\r
        };\r
-       X_Node_body._updateTimerID && X_Node_startUpdate();\r
+       X_Node_updateTimerID && X_Node_startUpdate();\r
        if( !this._root ){\r
                console.log( 'xnode.scrollLeft() : not belong tree.' );\r
                return 0;\r
@@ -207,7 +207,7 @@ Node.prototype.scrollTop = function(){
                console.log( 'xnode.scrollTop() : no parent' );\r
                return 0;\r
        };\r
-       X_Node_body._updateTimerID && X_Node_startUpdate();\r
+       X_Node_updateTimerID && X_Node_startUpdate();\r
        if( !this._root ){\r
                console.log( 'xnode.scrollTop() : not belong tree.' );\r
                return 0;\r
@@ -237,7 +237,7 @@ Node.prototype.x = function(){
                console.log( 'xnode.x() : no parent' );\r
                return 0;\r
        };\r
-       X_Node_body._updateTimerID && X_Node_startUpdate();\r
+       X_Node_updateTimerID && X_Node_startUpdate();\r
        if( !this._root ){\r
                console.log( 'xnode.x() : not belong tree.' );\r
                return 0;\r
@@ -260,7 +260,7 @@ Node.prototype.y = function(){
                console.log( 'xnode.y() : no parent' );\r
                return 0;\r
        };\r
-       X_Node_body._updateTimerID && X_Node_startUpdate();\r
+       X_Node_updateTimerID && X_Node_startUpdate();\r
        if( !this._root ){\r
                console.log( 'xnode.y() : not belong tree.' );\r
                return 0;\r
@@ -285,7 +285,7 @@ Node.prototype.offset = function( /* xnodeParent */ ){
                console.log( 'xnode.offset() : no parent' );\r
                return { x : 0, y : 0 };\r
        };\r
-       X_Node_body._updateTimerID && X_Node_startUpdate();\r
+       X_Node_updateTimerID && X_Node_startUpdate();\r
        if( !this._root ){\r
                console.log( 'xnode.offset() : not belong tree.' );\r
                return { x : 0, y : 0 };\r
index 6c23b0b..5a5f16f 100644 (file)
@@ -45,7 +45,9 @@ X_Node_Attr_HAS_VALUE = {
                INPUT    : true,\r
                TEXTAREA : true,\r
                SELECT   : true,\r
-               BUTTON   : true\r
+               BUTTON   : true,\r
+               OBJECT   : true,\r
+               PARAM    : true // FlashVars が flash 側から書き換えられるケースがある\r
 },\r
 \r
 X_Node_Attr_renameForTag = {};\r
index 7fa9641..f0f3309 100644 (file)
@@ -367,7 +367,7 @@ X_Node_CSS_Property = X.Class.create(
                                if( u !== 'px' ){
                                        this.value =
                                                u === 'em' ?
-                                                       v / this.xnode._getCharSize() :
+                                                       v / X_Node_CSS_getCharSize( this.xnode ) :
                                                        v / ( X_Node_CSS__UNIT_RATIO[ u ] || 1 );
                                };
                        },
@@ -392,7 +392,7 @@ X_Node_CSS_Property = X.Class.create(
                                        u === 'px' ?
                                                v :
                                        ( u === 'em' || ( u === '' && this.name === 'lineHeight' ) ) ?
-                                               v * this.xnode._getCharSize() :
+                                               v * X_Node_CSS_getCharSize( this.xnode ) :
                                        // u === '%'
                                                v / ( X_Node_CSS__UNIT_RATIO[ u ] || 1 );
                        },
@@ -1067,85 +1067,85 @@ Node.prototype.cssText = function( v ){
  * TODO
  * body に css attr がセットされた場合には X_ViewPort_baseFontSize をクリア
  */
-
-Node.prototype._getCharSize =
+var
+X_Node_CSS_getCharSize =
        window.getComputedStyle ?
-               (function(){
-                       X_Node_body._updateTimerID && X_Node_startUpdate();
-                       if( this === X_Node_body && X_ViewPort_baseFontSize ) return X_ViewPort_baseFontSize;
-                       if( this._fontSize ) return this._fontSize;
-                       return this._fontSize = parseFloat( getComputedStyle( this._rawObject, null ).fontSize );
+               (function( that ){
+                       X_Node_updateTimerID && X_Node_startUpdate();
+                       if( that === X_Node_body && X_ViewPort_baseFontSize ) return X_ViewPort_baseFontSize;
+                       if( that._fontSize ) return that._fontSize;
+                       return that._fontSize = parseFloat( getComputedStyle( that._rawObject, null ).fontSize );
                }) :
 
        document.defaultView && document.defaultView.getComputedStyle ?
-               (function(){
-                       X_Node_body._updateTimerID && X_Node_startUpdate();
-                       if( this === X_Node_body && X_ViewPort_baseFontSize ) return X_ViewPort_baseFontSize;
-                       if( this._fontSize ) return this._fontSize;
-                       return this._fontSize = parseFloat( document.defaultView.getComputedStyle( this._rawObject, null ).fontSize );
+               (function( that ){
+                       X_Node_updateTimerID && X_Node_startUpdate();
+                       if( that === X_Node_body && X_ViewPort_baseFontSize ) return X_ViewPort_baseFontSize;
+                       if( that._fontSize ) return that._fontSize;
+                       return that._fontSize = parseFloat( document.defaultView.getComputedStyle( that._rawObject, null ).fontSize );
                }) :
 
        5.5 <= X_UA.IE ?
-               (function(){
+               (function( that ){
                        var font, vu, v, u, _v;
-                       X_Node_body._updateTimerID && X_Node_startUpdate();
-                       if( this === X_Node_body && X_ViewPort_baseFontSize ) return X_ViewPort_baseFontSize;
-                       if( this._fontSize ) return this._fontSize;
+                       X_Node_updateTimerID && X_Node_startUpdate();
+                       if( that === X_Node_body && X_ViewPort_baseFontSize ) return X_ViewPort_baseFontSize;
+                       if( that._fontSize ) return that._fontSize;
                        
-                       font = this._rawObject.currentStyle.fontSize;
-                       //font = this._css && this._css.fontSize || '1em';
+                       font = that._rawObject.currentStyle.fontSize;
+                       //font = that._css && that._css.fontSize || '1em';
                        vu   = X_Node_CSS__splitValueAndUnit( font );
                        v    = vu[ 0 ];
                        u    = vu[ 1 ];
 
                        if( v === 0 ){
-                               if( v = X_Node_CSS__FONT_SIZE_RATIO[ font ] ) return this._fontSize = v;
+                               if( v = X_Node_CSS__FONT_SIZE_RATIO[ font ] ) return that._fontSize = v;
                        } else {
-                               if( _v = X_Node_CSS__UNIT_RATIO[ u ] ) return this._fontSize = v / _v;
+                               if( _v = X_Node_CSS__UNIT_RATIO[ u ] ) return that._fontSize = v / _v;
                        };
                        switch( u ){
                                case 'px' :
-                                       return this._fontSize = v;
+                                       return that._fontSize = v;
                                case 'em' :
                                // body まで辿ってしまった場合は?
-                                       if( this.parent ) return this._fontSize = this.parent._getCharSize() * v;
+                                       if( that.parent ) return that._fontSize = X_Node_CSS_getCharSize( that.parent ) * v;
                                        break;
                                case '%' :
                                // body まで辿ってしまった場合は?
-                                       if( this.parent ) return this._fontSize = this.parent._getCharSize() * v / 100;
+                                       if( that.parent ) return that._fontSize = X_Node_CSS_getCharSize( that.parent ) * v / 100;
                        };
                        return 0;
                }) :
        X_UA_DOM.W3C ?
-               (function(){
+               (function( that ){
                        var elm, v;
-                       X_Node_body._updateTimerID && X_Node_startUpdate();
-                       if( this === X_Node_body && X_ViewPort_baseFontSize ) return X_ViewPort_baseFontSize;
-                       if( this._fontSize ) return this._fontSize;
+                       X_Node_updateTimerID && X_Node_startUpdate();
+                       if( that === X_Node_body && X_ViewPort_baseFontSize ) return X_ViewPort_baseFontSize;
+                       if( that._fontSize ) return that._fontSize;
 
-                       this._rawObject.appendChild( elm = document.createElement( 'span' ) );
+                       that._rawObject.appendChild( elm = document.createElement( 'span' ) );
                        elm.style.cssText = 'display:block;position:absolute;top:0;left:0;visivility:hidden;line-height:1;height:1em;';
                        elm.innerHTML = 'X';
                        v = elm.offsetHeight;
-                       this._rawObject.removeChild( elm );
-                       return this._fontSize = v;
+                       that._rawObject.removeChild( elm );
+                       return that._fontSize = v;
                }) :
        X_UA_DOM.IE4 ?
-               (function(){
+               (function( that ){
                        var font, vu, v, u, _v;
-                       X_Node_body._updateTimerID && X_Node_startUpdate();
-                       if( this === X_Node_body && X_ViewPort_baseFontSize ) return X_ViewPort_baseFontSize;
-                       if( this._fontSize ) return this._fontSize;
+                       X_Node_updateTimerID && X_Node_startUpdate();
+                       if( that === X_Node_body && X_ViewPort_baseFontSize ) return X_ViewPort_baseFontSize;
+                       if( that._fontSize ) return that._fontSize;
                        
-                       if( this._css && ( font = this._css.fontSize ) ){
+                       if( that._css && ( font = that._css.fontSize ) ){
                                vu = X_Node_CSS__splitValueAndUnit( font );
                                v  = vu[ 0 ];
                                u  = vu[ 1 ];
                                
                                if( v === 0 ){
-                                       if( _v = X_Node_CSS__FONT_SIZE_RATIO[ font ] ) return this._fontSize = _v;
+                                       if( _v = X_Node_CSS__FONT_SIZE_RATIO[ font ] ) return that._fontSize = _v;
                                } else {
-                                       if( _v = X_Node_CSS__UNIT_RATIO[ u ] ) return this._fontSize = v / _v;
+                                       if( _v = X_Node_CSS__UNIT_RATIO[ u ] ) return that._fontSize = v / _v;
                                };
                        } else {
                                v = 1;
@@ -1154,31 +1154,18 @@ Node.prototype._getCharSize =
 
                        switch( u ){
                                case 'px' :
-                                       return this._fontSize = v;
+                                       return that._fontSize = v;
                                case 'em' :
                                // body まで辿ってしまった場合は?
-                                       if( this.parent ) return this._fontSize = this.parent._getCharSize() * v;
+                                       if( that.parent ) return that._fontSize = X_Node_CSS_getCharSize( that.parent ) * v;
                                        break;
                                case '%' :
                                // body まで辿ってしまった場合は?
-                                       if( this.parent ) return this._fontSize = this.parent._getCharSize() * v / 100;
+                                       if( that.parent ) return that._fontSize = X_Node_CSS_getCharSize( that.parent ) * v / 100;
                        };
                        return 0;
                }) :
-               // ie5?
-               (function(){
-                       var elm, v;
-                       if( this === X_Node_body && X_ViewPort_baseFontSize ) return X_ViewPort_baseFontSize;
-                       X_Node_body._updateTimerID && X_Node_startUpdate();
-                       if( this._fontSize ) return this._fontSize;
-                       
-                       elm = this._rawObject;
-                       elm.insertAdjacentHTML( 'BeforeEnd', '<span style="visivility:hidden;line-height:1;">X</span>' );
-                       elm = elm.children[ elm.children.length - 1 ];
-                       v   = elm.offsetHeight;
-                       elm.outerHTML = '';
-                       return this._fontSize = v * 0.75;
-               });
+               0;
 
 
 X.CSS = {
index 1d1dbb7..2a746ff 100644 (file)
@@ -56,7 +56,10 @@ var
        // TODO { a : 1, A : 2, _ : 3,,, }\r
        X_Node_Selector__ALPHABET  = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-0123456789\\',\r
        X_Node_Selector__NUMBER    = '+-0123456789';\r
-                       \r
+\r
+// XMLWrapper のために今だけ外部に公開\r
+X_NodeSelector_parse = X_Node_Selector__parse;\r
+               \r
 /*\r
  * セレクタ文字列の解析、但し一挙に行わず、ひと塊づつ\r
  * 結合子 + 単体セレクタ( タグ,*,#,.,[],: )\r
index 5624baa..93f62f1 100644 (file)
@@ -54,7 +54,10 @@ X.Util.NinjaIframe = X.EventDispatcher.inherits(
                        \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
+                                       this._iwin.name = this._name;\r
                                        \r
                                        this.xnodeIframe.listen( X_UA.IE < 9 ? [ 'readystatechange', 'error' ] : [ 'load', 'error' ], this );\r
                                        \r
index 13bd9e5..806396c 100644 (file)
@@ -37,7 +37,9 @@ X.Net.JSONP = {
 
 var X_NET_JSONP_ACCESS_KEY = Math.random(),
        
-       X_NET_JSONP_NinjaIframe;
+       X_NET_JSONP_NinjaIframe,
+       
+       X_Net_JSONP_onloadCount;
 
 
 function X_NET_JSONP_loadScriptInNinjaIframe( url ){
@@ -48,35 +50,56 @@ function X_NET_JSONP_loadScriptInNinjaIframe( url ){
        X_NET_JSONP_NinjaIframe || ( X_NET_JSONP_NinjaIframe = new X.Util.NinjaIframe() );
        
        // TODO '<scr'+'ipt> 化 恐らくアンチウイルスソフトが反応しないための対策
-       
+       // TODO postMessage の利用
+
+       // numonLoad
+
+       if( X_UA.Opera ){
+               html = [
+                       ( window[ 'JSON' ] ? '' : '<script src="' + json2Path + '"></script>' ),
+                       '<script>',
+                               'onunload=function(){im.onload=im.onerror=""};',
+                               'nw=+new Date;',
+                               'function cb(o){if(nw){nw-=+new Date;parent.X.Net.JSONP.cb(' + X_NET_JSONP_ACCESS_KEY + ',JSON.stringify(o),-nw);nw=0}}',
+                       '</script>',    
+                       '<script id="jp"></script>',
+                       '<img id="im" src="', url, '" onload="jp.src=im.src" onerror="jp.src=im.src">'
+               ];
+               X_Net_JSONP_onloadCount = 2;
+       } else
        if( X_UA.IE8 ){
                html = [
                        // http://blog.livedoor.jp/dankogai/archives/51503830.html              
                        // Ajax - IE8にもJSON入ってます。使えるとは限らないけど
                        // Compatibility mode (別名Quirks mode) では、JSONオブジェクトは無効になります。iframeもだめです
-                       /* 以下のコードは XP ie8 では動くけど、win8 IE11(8モード)で動かない 開発の便宜を取って,setTimeout を挟む
-                       '<script>',
-                               'function cb(o){window.parent.X.Net.JSONP.cb(' + X_NET_JSONP_ACCESS_KEY + ',window.parent.JSON.stringify(o))}',
-                       '</script>',
-                       '<script src="', url, '"></script>' */
                        '<script id="jp"></script>',
                        '<script>',
+                               'onunload=function(){clearTimeout(id)};',
                                'nw=0;', // なぜか必要,,,
                                'function cb(o){nw-=+new Date;parent.X.Net.JSONP.cb(' + X_NET_JSONP_ACCESS_KEY + ',parent.JSON.stringify(o),-nw)}',
                                'function tm(){jp.src="', url ,'";nw=+new Date}',
-                               'setTimeout(tm,16);',
+                               'id=setTimeout(tm,16);',
                        '</script>'
+                       
+                       /* 以下のコードは XP ie8 では動くけど、win8 IE11(8モード)で動かない 開発の便宜を取って,setTimeout を挟む
+                       '<script>',
+                               'function cb(o){window.parent.X.Net.JSONP.cb(' + X_NET_JSONP_ACCESS_KEY + ',window.parent.JSON.stringify(o))}',
+                       '</script>',
+                       '<script src="', url, '"></script>' */
                ];
+               X_Net_JSONP_onloadCount = 2;
        } else
        if( X_UA.IE9 ){
                html = [
                        '<script id="jp"></script>',
                        '<script>',
+                               'onunload=function(){clearTimeout(id)};',
                                'function cb(o){nw-=+new Date;parent.X.Net.JSONP.cb(' + X_NET_JSONP_ACCESS_KEY + ',JSON.stringify(o),-nw)}',
                                'function tm(){jp.src="', url ,'";nw=+new Date}',
-                               'setTimeout(tm,16);',
+                               'id=setTimeout(tm,16);',
                        '</script>'
                ];
+               X_Net_JSONP_onloadCount = 2;
        } else
        if( window[ 'JSON' ] ){
                html = [        
@@ -86,30 +109,35 @@ function X_NET_JSONP_loadScriptInNinjaIframe( url ){
                        '</script>',
                        '<script src="', url, '"></script>'
                ];
+               X_Net_JSONP_onloadCount = 1;
        } else
        if( X_UA.IE4 || X_UA.MacIE ){
                html = [
                        '<script id="jn"></script>',
                        '<script id="jp"></script>',
                        '<script>',
+                               'onunload=function(){clearTimeout(id)};',
                                'function cb(o){nw-=new Date;parent.X.Net.JSONP.cb(' + X_NET_JSONP_ACCESS_KEY + ',JSON.stringify(o),-nw-16,', json2FileSize, ')}',
-                               'function t1(){document.all.jn.src="', json2Path ,'";setTimeout("t2()",16);nw=+new Date}',
-                               'setTimeout("t1()",16);',
-                               'function t2(){if(window.JSON){document.all.jp.src="', url ,'"}else{setTimeout("t2()",16)}}',
+                               'function t1(){document.all.jn.src="', json2Path ,'";id=setTimeout("t2()",16);nw=+new Date}',
+                               'id=setTimeout("t1()",16);',
+                               'function t2(){if(window.JSON){document.all.jp.src="', url ,'"}else{id=setTimeout("t2()",16)}}',
                        '</script>'
                ];
+               X_Net_JSONP_onloadCount = 3;
        } else
        if( X_UA.IE < 8 ){ // ie5-7
                html = [
                        '<script id="jn"></script>',
                        '<script id="jp"></script>',
                        '<script>',
+                               'onunload=function(){clearTimeout(id)};',
                                'function cb(o){nw-=new Date;parent.X.Net.JSONP.cb(' + X_NET_JSONP_ACCESS_KEY + ',JSON.stringify(o),-nw-16,', json2FileSize, ')}',
-                               'function t1(){jn.src="', json2Path ,'";setTimeout(t2,16);nw=+new Date}',
-                               'setTimeout(t1,16);',
-                               'function t2(){if(window.JSON){jp.src="', url ,'"}else{setTimeout(t2,16)}}',
+                               'function t1(){jn.src="', json2Path ,'";id=setTimeout(t2,16);nw=+new Date}',
+                               'id=setTimeout(t1,16);',
+                               'function t2(){if(window.JSON){jp.src="', url ,'"}else{id=setTimeout(t2,16)}}',
                        '</script>'
                ];
+               X_Net_JSONP_onloadCount = 3;
        } else {
                html = [
                        '<script>',
@@ -119,6 +147,7 @@ function X_NET_JSONP_loadScriptInNinjaIframe( url ){
                        '<script src="', json2Path, '"></script>',
                        '<script src="', url, '"></script>'
                ];
+               X_Net_JSONP_onloadCount = 1;
        };
        
        X_NET_JSONP_NinjaIframe
@@ -130,14 +159,18 @@ function X_NET_JSONP_loadScriptInNinjaIframe( url ){
 function X_NET_JSONP_iframeListener( e ){
        switch( e.type ){
                case X.Event.SUCCESS :
-                       console.log( 'iframe onload' );
-
+                       console.log( 'iframe onload, but' );
+                       if( ++X_NET_JSONPWrapper._onloadCount < X_Net_JSONP_onloadCount ) return;
+                       // TODO callback が無ければ error
+                       X_NET_JSONPWrapper.asyncDispatch( 1000, X.Event.ERROR );
                        break;
                case X.Event.ERROR :
                        console.log( 'iframe onerror' );
-                       X_NET_JSONPWrapper.asyncDispatch( 0, X.Event.ERROR );
+                       X_NET_JSONPWrapper.asyncDispatch( X.Event.ERROR );
                        break;
        };
+       X_NET_JSONP_NinjaIframe.unlisten();
+       return X.Callback.UN_LISTEN;
 };
 
 
@@ -145,51 +178,24 @@ X_NET_JSONPWrapper = X_Class_override(
        new X.EventDispatcher(),
        {
 
-               _operaImage   : null, // X.Net.Image();
                _busy         : false,
                _canceled     : false,
+               _onloadCount  : 0,
                
                load : function( url, data, timeout ){
                        //createURL
-                       if( X_NET_JSONP_operaImageHandleEvent ){
-                               this._operaImage = X.Net.Image( url, false )
-                                       .listenOnce( [ X.Event.SUCCESS, X.Event.ERROR, X.Event.TIMEOUT ], X_NET_JSONP_operaImageHandleEvent );
-                       } else {
-                               X_NET_JSONP_loadScriptInNinjaIframe( url );
-                       };
+                       X_NET_JSONP_loadScriptInNinjaIframe( url );
                                                
                        this._busy = true;
                },
                
                cancel : function(){
-                       if( this._operaImage ){
-                               this._operaImage
-                                       .unlisten( [ X.Event.SUCCESS, X.Event.ERROR, X.Event.TIMEOUT ], X_NET_JSONP_operaImageHandleEvent )
-                                       .cancel();
-                               delete this._operaImage;
-                       } else {
-                               this._canceled = true;
-                       };
+                       this._canceled = true;
                },
                
                reset : function(){
                        this._busy = this._canceled = false;
+                       this._onloadCount = 0;
                }
        }
 );
-
-function X_NET_JSONP_operaImageHandleEvent( e ){
-       switch( e.type ){
-               case X.Event.SUCCESS :
-               case X.Event.ERROR :
-                       X_NET_JSONP_loadScriptInNinjaIframe( e.src );
-                       break;
-               case X.Event.TIMEOUT :
-                       X_NET_JSONPWrapper._operaImage
-                               .unlisten( [ X.Event.SUCCESS, X.Event.ERROR, X.Event.TIMEOUT ], X_NET_JSONP_operaImageHandleEvent )
-                               .reset();
-                       X_NET_JSONPWrapper.asyncDispatch( 0, X.Event.ERROR );
-                       break;
-       };
-};
-if( !X_UA.Opera ) X_NET_JSONP_operaImageHandleEvent = null;
\ No newline at end of file
index 6a90a46..853ec82 100644 (file)
@@ -43,24 +43,15 @@ X_NET_ImageWrapper = X_Class_override(
                        this.abspath = X.URL.toAbsolutePath( data.url );\r
                        this.delay   = data.delay || 100;\r
                        this.timeout = data.timeout || 5000;\r
-                       this.timerID = X.Timer.add( this.delay, 0, this, this._detect );\r
-                       \r
-                       //X_Net_Image_hasImage ? ( this._rawObject.src = this.abspath ) : this.attr( 'src', this.abspath );\r
-                       /*\r
-                       if( X_UA.Opera7 ){\r
-                               X_EventDispatcher_toggleAllEvents( this, false );\r
-                               this._rawObject = new Image();\r
-                               X_EventDispatcher_toggleAllEvents( this, true );\r
-                       }; */\r
-                       \r
+                       //this.timerID = X.Timer.add( this.delay, 0, this, this._detect );\r
+\r
                        this._rawObject.src = this.abspath;\r
-                       //alert( this._rawObject.src + ' ' + this._rawObject.complete );\r
+\r
                        if( X_UA.Opera7 && this._rawObject.complete ){\r
                                this.asyncDispatch( 'load' );\r
                        } else {\r
                                this.timerID = X.Timer.add( this.delay, 0, this, this._detect );\r
                        };\r
-                       //alert( this._rawObject.src + ' ' + this._rawObject.complete );\r
                },\r
                \r
                handleEvent : function( e ){\r
@@ -119,6 +110,7 @@ X_NET_ImageWrapper = X_Class_override(
                cancel : function(){\r
                        // abort がある?\r
                        this._rawObject && this._rawObject.abort && this._rawObject.abort();\r
+                       // this._rawObject.src = '';\r
                        this._busy  = false;\r
                        this.finish = true;\r
                        this.asyncDispatch( X.Event.CANCELED );\r
index 536e229..3bce85d 100644 (file)
@@ -53,21 +53,21 @@ if( window.HTMLAudioElement ){
                                var ok, mineType = 'audio/' + ext;\r
                                switch( ext ){\r
                                        case 'mp3' :\r
-                                               ok = X.UA.IE || X.UA.Chrome || X.UA.Safari; //( X.UA.OS === 'windows' && X.UA.Safari );\r
+                                               ok = X_UA.IE || X_UA.Chrome || X_UA.Safari; //( X_UA.OS === 'windows' && X_UA.Safari );\r
                                                mineType = 'audio/mpeg';\r
                                                break;\r
                                        case 'ogg' :\r
-                                               ok = 15 <= X.UA.Gecko || X.UA.Chrome || X.UA.Opera;\r
+                                               ok = 15 <= X_UA.Gecko || X_UA.Chrome || X_UA.Opera;\r
                                                break;\r
                                        case 'm4a' :\r
-                                               ok = X.UA.IE || X.UA.WebKit;\r
+                                               ok = X_UA.IE || X_UA.WebKit;\r
                                                mineType = 'audio/mp4';\r
                                                break;\r
                                        case 'webm' :\r
-                                               ok = 2 <= X.UA.Gecko || 10.6 <= X.UA.Opera; // firefox4+(Gecko2+)\r
+                                               ok = 2 <= X_UA.Gecko || 10.6 <= X_UA.Opera; // firefox4+(Gecko2+)\r
                                                break;\r
                                        case 'wav' :\r
-                                               ok = X.UA.Gecko || X.UA.Opera || X.UA.Safari; //( X.UA.OS === 'windows' && X.UA.Safari );\r
+                                               ok = X_UA.Gecko || X_UA.Opera || X_UA.Safari; //( X_UA.OS === 'windows' && X_UA.Safari );\r
                                                //mineType = 'audio/wav'; // audio/x-wav ?\r
                                                break;\r
                                        default :\r
@@ -236,7 +236,7 @@ if( window.HTMLAudioElement ){
                            if( this._closed ) return;\r
                            this._lastUserAction = 'play';\r
                        \r
-                           if( X.UA.Chrome ){ // [CHROME][FIX] volume TODO どの version で 修正される?\r
+                           if( X_UA.Chrome ){ // [CHROME][FIX] volume TODO どの version で 修正される?\r
                                // [!] delay\r
                                X.Timer.once( 0, this, this._fixForChrome, [ this._rawObject.volume ] );\r
                                this._rawObject.volume = 0;\r
@@ -249,7 +249,7 @@ if( window.HTMLAudioElement ){
                        },\r
                        \r
                        // [CHROME][FIX] volume\r
-                       _fixForChrome : X.UA.Chrome && function( volume ){\r
+                       _fixForChrome : X_UA.Chrome && function( volume ){\r
                                !this._closed && ( this._rawObject.volume = volume );\r
                        },\r
                        \r
index 3eb6538..484a900 100644 (file)
@@ -129,6 +129,8 @@ if( X.Pulgin.SilverlightEnabled ){
                                 * http://www.atmarkit.co.jp/fdotnet/dotnettips/902slobjcallfromjs/slobjcallfromjs.html\r
                                 * このページのサンプルは sl5+firefox32 環境で動いている。xaml を js から利用する形ではなく、.xap を sl4 以下で作るのがよさそう.\r
                                 */\r
+                               \r
+                               // TODO embed\r
                                this.proxy       = proxy;\r
                        this._onload     = 'XAudioSilverlightOnLoad' + ( ++X_Audio_SLAudio_uid );\r
                                this._callback   = window[ this._onload ] = X_Callback_create( this, this.onSLReady, [ option.autoplay ] );\r
@@ -162,7 +164,7 @@ if( X.Pulgin.SilverlightEnabled ){
                                \r
                                window[ this._onload ] = null;\r
                                delete this._onload;\r
-                               this._callback.kill();\r
+                               X_Callback_correct( this._callback );\r
                                delete this._callback;\r
 \r
                                //if( sender.findName('media') ) alert( 'exist' );\r