From: itozyun Date: Tue, 7 Oct 2014 13:26:08 +0000 (+0900) Subject: Version 0.6.94, new X.Callback is fast & light maybe. X-Git-Url: http://git.osdn.jp/view?p=pettanr%2FclientJs.git;a=commitdiff_plain;h=5f61a48d303bf9ca6bf021d8957aac743fc8958b Version 0.6.94, new X.Callback is fast & light maybe. --- diff --git a/0.6.x/js/01_core/01_X.js b/0.6.x/js/01_core/01_X.js index e53d43e..9706243 100644 --- a/0.6.x/js/01_core/01_X.js +++ b/0.6.x/js/01_core/01_X.js @@ -10,7 +10,7 @@ if( !window['console'] || ( window.parent && window.parent.log ) ) console = { l var undefined, X = new Function( 'return X._shortcut && X._shortcut.apply( X._shortcut, arguments )' ), - X_TEMP = {}; + X_TEMP = { onSystemReady : [] }; X.VERSION = '0.6.89'; @@ -31,94 +31,3 @@ X.inHead = (function( s ){ return s.tagName.toLowerCase() === 'head';// opera7.23 s.tagName is 'HTML' })( document.scripts || document.getElementsByTagName && document.getElementsByTagName( 'script' ) || document.all && document.all.tags( 'script' ) ); -X.parse = function( v ){ - var _v, n; - if( Type.isString( v ) === true ){ - switch( v ){ - case '' : return v; - //case '{}' : return {}; - //case '[]' : return []; - case 'NaN' : return NaN; - case 'null' : return null; - case 'true' : return true; - case 'false' : return false; - case 'Infinity' : return 1/0;//Number.POSITIVE_INFINITY; - case '-Infinity' : return -1/0;//Number.NEGATIVE_INFINITY; - case 'void(0)' : - case 'void 0' : - case 'undefined' : return; - }; - _v = v.split( ' ' ).join( '' ); - n = _v - 0; - if( '' + n === _v || '' + n === '0' + _v ) return n; - }; - return v; -}; - -X.cloneObject = function( src ){ - var ret, k; - if( typeof src !== 'object' ) return src; - ret = {}; - for( k in src ){ - ret[ k ] = src[ k ]; - }; - return ret; -}; - -X.deepCopy = function( src ){ - function clone( src, objSrc, objCopy, n ) { - var ret, i, key; - if( !src ){ // 0, "", null, undefined, NaN, false - return src; - } else - if( X.Type.isArray( src ) ){ - i = objSrc.indexOf( src ); - if( i !== -1 ) return objCopy[ i ]; - objSrc[ ++n ] = src; - objCopy[ n ] = ret = []; - } else - if( X.Type.isObject( src ) ){ - i = objSrc.indexOf( src ); - if( i !== -1 ) return objCopy[ i ]; - objSrc[ ++n ] = src; - objCopy[ n ] = ret = {}; - } else { - // string, number, true - return src; - }; - for( key in src ){ - ret[ key ] = clone( src[ key ], objSrc, objCopy, n ); - }; - return ret; - }; - return clone( src, [], [], -1 ); -}; - - - - -X.copyArray = function( ary ){ - var ret = [], i = ary.length; - if( !i ) return ret; - for( ; i; ){ - ret[ --i ] = ary[ i ]; - }; - return ret; -}; - -X.isEmptyObject = function( v ){ - var p; -// if( v.length ) return false; - for( p in v ){ - if( v.hasOwnProperty( p ) ) return false; - }; - return true; -}; - -X.matchTest = function( array1, array2 ){ - var i = array2.length; - for( ; i; ){ - if( array1.indexOf( array2[ --i ] ) === -1 ) return false; - }; - return true; -}; diff --git a/0.6.x/js/01_core/02_XUA.js b/0.6.x/js/01_core/02_XUA.js index 1f55c6f..41a5bc3 100644 --- a/0.6.x/js/01_core/02_XUA.js +++ b/0.6.x/js/01_core/02_XUA.js @@ -1,13 +1,13 @@ -/* - * UA - */ -X.UA = (function( n, undefined ){ +// ------------------------------------------------------------------------- // +// ------------ local variables -------------------------------------------- // +// ------------------------------------------------------------------------- // +var X_UA = (function( n, undefined ){ var acme = {}, dua = n.userAgent, dav = n.appVersion, tv = parseFloat(dav), - i, j, v; + tridentToVer, i, j, v; console.log( ' userAgent : ' + dua ); console.log( '-' ); @@ -39,11 +39,18 @@ X.UA = (function( n, undefined ){ // Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko if( document.all || dav.indexOf( 'Trident/' ) !== -1 ){ acme.ActiveX = !!window[ 'ActiveXObject' ]; - acme.IE = document.documentMode || parseFloat(dua.split('MSIE ')[1]) || parseFloat(dua.split('rv:')[1]) || parseFloat(dav.split('MSIE ')[1]) || 0; + acme._IE = parseFloat(dua.split('MSIE ')[1]) || parseFloat(dua.split('rv:')[1]) || parseFloat(dav.split('MSIE ')[1]) || 0; + // IE11 の互換モードの dav にも Trident/7.0 が書かれているため互換モードか?判定ができる + // 互換モードでは Silverlight でエラーが出る? + acme.Trident = parseFloat(dav.split('Trident/')[1]) || 0; + acme.IE = document.documentMode || acme._IE; + tridentToVer = acme.Trident ? ( acme.Trident + 4 | 0 ) : acme._IE; + acme.IECompat = /* acme.IE !== acme._IE || */ tridentToVer !== acme._IE && tridentToVer; acme.IE4 = acme.IE && acme.IE < 5; acme.IE5678 = 5 <= acme.IE && acme.IE < 9; acme.IE5 = 5 <= acme.IE && acme.IE < 5.5; acme.IE55 = 5.5 <= acme.IE && acme.IE < 6; + acme.IE5x = acme.IE5 || acme.IE55; acme.IE6 = 6 <= acme.IE && acme.IE < 7; acme.IE7 = 7 <= acme.IE && acme.IE < 8; acme.IE8 = 8 <= acme.IE && acme.IE < 9; @@ -230,14 +237,52 @@ X.UA = (function( n, undefined ){ dua.indexOf( 'EBRD' ) !== -1; return acme; -})( navigator ); +})( navigator ), + +X_UA_DOM = {}, +X_UA_EVENT = {}, +X_UA_HID = {}; +X_UA.IECompat && alert( X_UA.IE + ' ' + X_UA._IE + ' Tri:' + X_UA.Trident ); -//alert(X.UA.Safari + ' ' + X.UA.WebKit + '\n\n' + navigator.userAgent + '\n\n' + navigator.appVersion + '\n\n' + navigator.platform ); +/* + * http://d.hatena.ne.jp/t-uchima/20051003/p1 + * MacIEにはattachEventが一応あるけどwindow.attachEventとdocument.attachEventしかなく他の要素にはattachEventはない。 + */ + +if( X_UA.IE4 && X_UA.IE < 5 ){ // ie4 & iemobi4 & macie4.x + X_UA_DOM.IE4 = true; + X_UA_EVENT.IE4 = true; +} else +if( X_UA.MacIE ){ + X_UA_DOM.W3C = true; + X_UA_EVENT.IE = true; +} else +if( document.getElementById ){ + X_UA_DOM.W3C = true; + if( document.addEventListener ){ + X_UA_EVENT.W3C = true; + } else + if( document.attachEvent ){ + X_UA_EVENT.IE = true; + } else { + X_UA_EVENT.DOM0 = true; + }; +} else +if( document.layers ){ + +} else { + +}; + +if( navigator.msPointerEnabled || navigator.pointerEnabled ) X_UA_HID.POINTER = true; +if( !X_UA_HID.POINTER && window.ontouchstart !== undefined ) X_UA_HID.TOUCH = true; + +//alert(X_UA.Safari + ' ' + X_UA.WebKit + '\n\n' + navigator.userAgent + '\n\n' + navigator.appVersion + '\n\n' + navigator.platform ); // Safari 3.1 未満は開発コンソールがない! // http://shimax.cocolog-nifty.com/search/2006/09/safarijavascrip_c54d.html /* -if( X.UA.Safari && X.UA.WebKit < 525.13 ){ +if( X_UA.Safari && X_UA.WebKit < 525.13 ){ window.onerror = function( x, y, z ){ var n = String.fromCharCode( 10 ); alert('window.onerrorによるエラーの捕捉:' + n + x + n + y + 'の' + z + '行目付近です。'); @@ -245,20 +290,21 @@ if( X.UA.Safari && X.UA.WebKit < 525.13 ){ }; };*/ -if( X.UA.IE < 7 ){ // error @ NN7.2 +// ------------------------------------------------------------------------- // +// --- interface ----------------------------------------------------------- // +// ------------------------------------------------------------------------- // +X.UA = X_UA; + + + +if( X_UA.IE < 7 ){ // error @ NN7.2 // bonus: hotfix for IE6 SP1 (bug KB823727) - // multipleIEs IE6 standalone 版では不可 - document.execCommand && document.execCommand( 'BackgroundImageCache', false, true ); + // multipleIEs IE6 standalone 版では不可, IE5.5 は可,,, + X_UA.IE4 || X.UA.MacIE ? + document.execCommand && document.execCommand( 'BackgroundImageCache', false, true ) : + (function(){ + X_UA.IE_EXECOM_ERROR = eval( 'var a=1;try{document.execCommand&&document.execCommand("BackgroundImageCache",!1,!0)}catch(e){a=0}!a' ); + })(); + + X_UA.IE_EXECOM_ERROR && alert( 'document.execCommand error!' ); }; - -X.inObject = X.UA.IE < 5.5 ? // TODO JScript で判定 - (function( name, obj ){ - var p; - if( obj[ name ] ) return true; - name += ''; // 数値も許可 - for( p in obj ){ - if( p === name ) return true; - }; - return false; - }) : - new Function( 'a,b', 'return a in b' );// なぜか ie5 でもerror diff --git a/0.6.x/js/01_core/10_XCallback.js b/0.6.x/js/01_core/10_XCallback.js index 7e880de..4fb5aaa 100644 --- a/0.6.x/js/01_core/10_XCallback.js +++ b/0.6.x/js/01_core/10_XCallback.js @@ -3,15 +3,22 @@ // ------------ local variables -------------------------------------------- // // ------------------------------------------------------------------------- // -var XCallback_USE_CLOSURE = false, - - XCallback_LIVE_LIST = [], - XCallback_POOL_LIST = [], - - XCallback_THIS_FUNC = 1, - XCallback_HANDLEEVENT = 2, - XCallback_FUNC_ONLY = 3; +var X_Callback_LIVE_LIST = [], + X_Callback_POOL_LIST = [], + X_Closure_COMMAND_BACK = X_Callback_LIVE_LIST, + X_Closure_COMMAND_DROP = X_Callback_POOL_LIST, + X_Callback_THIS_FUNC = 1, + X_Callback_HANDLEEVENT = 2, + X_Callback_FUNC_ONLY = 3; + + X_Callback_NONE = 0, + X_Callback_UN_LISTEN = 1, + X_Callback_STOP_PROPAGATION = 2, // 上位階層への伝播のキャンセル + X_Callback_STOP_NOW = 4 | 2, // 同一階層のリスナーのキャンセル(上位へもキャンセル) + X_Callback_PREVENT_DEFAULT = 8, // 結果動作のキャンセル, + X_Callback_MONOPOLY = 16, // move event を独占する + X_Callback_SYS_CANCEL = 32 | 4 | 2; /* * handleEvent という関数のメンバーを持つオブジェクト @@ -27,212 +34,201 @@ var callbackHash; /* * - * @typedef {funciton} + * @typedef {(funciton|{ _ : function, same : function, kill : function, a : (Array|undefined) })} */ var functionHash; X.Callback = { - NONE : 0, - UN_LISTEN : 1, - STOP_PROPAGATION : 2, // 上位階層への伝播のキャンセル - STOP_NOW : 4 | 2, // 同一階層のリスナーのキャンセル(上位へもキャンセル) - PREVENT_DEFAULT : 8, // 結果動作のキャンセル, - MONOPOLY : 16, // move event を独占する - SYS_CANCEL : 32 | 4 | 2, - - _USE_CLOSURE : false, - - _LIVE_LIST : [], - _POOL_LIST : [], - - _THIS_FUNC : 1, - _HANDLEEVENT : 2, - _FUNC_ONLY : 3, - - create : function( arg1, arg2, arg3 /* [ listener || ( context + function ) || function ][ args... ] */ ){ - var live = X.Callback._LIVE_LIST, - hash = X.Callback._classifyCallbackArgs( arg1, arg2, arg3 ), - f; - - if( !hash.k ) return hash; - - f = X.Callback._POOL_LIST.pop(); - if( !f ){ - f = new Function( 'var a=arguments,f=a.callee;f.a=a;return f._(f)' ); // f.x=this; - f[ 'kill' ] = X.Callback._kill; - f[ 'same' ] = X.Callback._same; - f._ = X.Callback._proxyCallback; - }; - - live[ live.length ] = f; - - switch( f.k = hash.k ){ - case X.Callback._THIS_FUNC : - f.x = hash.x; - f.f = hash.f; - break; - case X.Callback._HANDLEEVENT : - f.x = hash.x; - break; - case X.Callback._FUNC_ONLY : - f.f = hash.f; - break; - }; - - if( hash.s ) f.s = hash.s; - return f; - }, + NONE : X_Callback_NONE, + UN_LISTEN : X_Callback_UN_LISTEN, + STOP_PROPAGATION : X_Callback_STOP_PROPAGATION, + STOP_NOW : X_Callback_STOP_NOW, + PREVENT_DEFAULT : X_Callback_PREVENT_DEFAULT, + MONOPOLY : X_Callback_MONOPOLY, - _createClosure : function( obj ){ - return function(){ - obj.a = arguments; - return obj._( obj ); - }; - }, - - _classifyCallbackArgs : function( arg1, arg2, arg3, alt_context ){ - var obj; - - if( arg1 && X.Type.isFunction( arg2 ) ){ - obj = { x : arg1, f : arg2, k : X.Callback._THIS_FUNC }; - } else - if( arg1 && X.Type.isFunction( arg1[ 'handleEvent' ] ) ){ - obj = { x : arg1, k : X.Callback._HANDLEEVENT }; - arg3 = arg2; - } else - if( X.Type.isFunction( arg1 ) ){ - arg3 = arg2; - if( alt_context ){ - obj = { x : alt_context, f : arg1, k : X.Callback._THIS_FUNC }; - } else { - obj = { f : arg1, k : X.Callback._FUNC_ONLY }; - }; - } else - if( X.Type.isFunction( arg2 ) ){ - //console.log( 'X.Callback._classifyCallbackArgs : arg1 が ' + arg1 + 'です' ); ie4 で error - if( alt_context ){ - obj = { x : alt_context, f : arg2, k : X.Callback._THIS_FUNC }; - } else { - obj = { f : arg2, k : X.Callback._FUNC_ONLY }; - }; - } else - if( alt_context ){ - obj = { x : alt_context, k : X.Callback._HANDLEEVENT }; - arg3 = arg1; - } else { - console.log( '不正 ' + arg1 ); - console.dir( arg1 ); - return; - }; - - if( X.Type.isArray( arg3 )){ - obj.s = arg3; - }; - return ( obj.x || obj.s ) ? obj : arg1; - }, - - _proxyCallback : function( xfunc ){ - var args = xfunc.a || [], - thisObj = xfunc.x, - func = xfunc.f, - supp = xfunc.s, - temp, ret; - - delete xfunc.a; - - if( supp && supp.length ){ - temp = []; - args.length && - ( - args.length === 1 ? - ( temp[ 0 ] = args[ 0 ] ) : - temp.push.apply( temp, args ) - ); - supp.length === 1 ? - ( temp[ temp.length ] = supp[ 0 ] ) : - temp.push.apply( temp, supp ); - args = temp; - }; - - switch( xfunc.k ){ - - case X.Callback._THIS_FUNC : - return args.length === 0 ? func.call( thisObj ) : func.apply( thisObj, args ); - - case X.Callback._HANDLEEVENT : - temp = thisObj[ 'handleEvent' ]; - if( X.Type.isFunction( temp ) ){ - return args.length === 0 ? thisObj[ 'handleEvent' ]() : - args.length === 1 ? thisObj[ 'handleEvent' ]( args[ 0 ] ) : temp.apply( thisObj, args ); - }; - break; - /* - if( temp !== func && X.Type.isFunction( temp ) ){ - return args.length === 0 ? thisObj[ 'handleEvent' ]() : temp.apply( thisObj, args ); - } else - if( X.Type.isFunction( thisObj ) ){ - return args.length === 0 ? thisObj.call( thisObj ) : thisObj.apply( thisObj, args ); - }; - return args.length === 0 ? func.call( thisObj ) : func.apply( thisObj, args );*/ - - case X.Callback._FUNC_ONLY : - return args.length === 0 ? - func() : - args.length === 1 ? - func( args[ 0 ] ) : - func.apply( null, args ); - }; - return X.Callback.NONE; - }, - - _kill : function(){ - X.Callback._correct( this ); - }, - _same : function( arg1, arg2, arg3 ){ - var hash; - - if( arg1 && arg1[ 'kill' ] === X.Callback._kill ) return this === arg1; - - hash = X.Callback._classifyCallbackArgs( arg1, arg2, arg3 ); - - return hash && this.k === hash.k && this.x === hash.x && this.f === hash.f && this.s === hash.s; - }, - _correct : function( f ){ - var i = X.Callback._LIVE_LIST.indexOf( f ); - //delete f._; - delete f.k; - if( f.x ) delete f.x; - if( f.f ) delete f.f; - if( f.s ) delete f.s; - if( i === -1 ) return; - X.Callback._LIVE_LIST.splice( i, 1 ); - X.Callback._POOL_LIST.push( f ); - }, + create : X_Callback_create, sys_monitor : function(){ return { - 'Live callback' : X.Callback._LIVE_LIST.length, - 'Pool callback' : X.Callback._POOL_LIST.length + 'Live callback' : X_Callback_LIVE_LIST.length, + 'Pool callback' : X_Callback_POOL_LIST.length }; }, + sys_gc : function(){ - var list = X.Callback._POOL_LIST, + var list = X_Callback_POOL_LIST, f; while( 0 < list.length ){ f = list.shift(); - X.Callback._correct( f ); - delete f[ '_' ]; + X_Callback_correct( f ); delete f[ 'kill' ]; delete f[ 'same' ]; }; } }; +X_TEMP.onSystemReady.push( X_Callback_handleSystemEvent ); + // ------------------------------------------------------------------------- // // --- implements ---------------------------------------------------------- // // ------------------------------------------------------------------------- // +function X_Callback_handleSystemEvent( e ){ + switch( e ){ + case '': + }; +}; + +function X_Callback_create( thisObject, opt_callback, opt_args /* [ listener || ( context + function ) || function ][ args... ] */ ){ + var obj = X_Callback_classifyCallbackArgs( thisObject, opt_callback, opt_args ), + l, ret, _obj; + if( !obj.k ) return obj; + if( l = X_Callback_POOL_LIST.length ){ + ret = X_Callback_POOL_LIST[ l - 1 ]; --X_Callback_POOL_LIST.length; // ret = X_Callback_POOL_LIST.pop(); + _obj = ret( X_Closure_COMMAND_BACK ); + _obj.k = obj.k; + _obj.f = obj.f; + _obj.x = obj.x; + _obj.s = obj.s; + } else { + ret = X_Closure_actualClosure( obj ); + ret.kill = X_Callback_kill; + ret.same = X_Callback_same; + }; + X_Callback_LIVE_LIST[ X_Callback_LIVE_LIST.length ] = ret; + return ret; +}; + +function X_Closure_actualClosure( obj ){ + return function(){ + if( arguments[ 0 ] === X_Closure_COMMAND_BACK ) return obj; + if( arguments[ 0 ] !== X_Closure_COMMAND_DROP ) return X_Callback_proxyCallback( obj, arguments ); + }; +}; + +function X_Callback_classifyCallbackArgs( arg1, arg2, arg3, alt_context ){ + var obj; + + if( arg1 && X.Type.isFunction( arg2 ) ){ + obj = { x : arg1, f : arg2, k : X_Callback_THIS_FUNC }; + } else + if( arg1 && X.Type.isFunction( arg1[ 'handleEvent' ] ) ){ + obj = { x : arg1, k : X_Callback_HANDLEEVENT }; + arg3 = arg2; + } else + if( X.Type.isFunction( arg1 ) ){ + arg3 = arg2; + if( alt_context ){ + obj = { x : alt_context, f : arg1, k : X_Callback_THIS_FUNC }; + } else { + obj = { f : arg1, k : X_Callback_FUNC_ONLY }; + }; + } else + if( X.Type.isFunction( arg2 ) ){ + //console.log( 'X_Callback_classifyCallbackArgs : arg1 が ' + arg1 + 'です' ); ie4 で error + if( alt_context ){ + obj = { x : alt_context, f : arg2, k : X_Callback_THIS_FUNC }; + } else { + obj = { f : arg2, k : X_Callback_FUNC_ONLY }; + }; + } else + if( alt_context ){ + obj = { x : alt_context, k : X_Callback_HANDLEEVENT }; + arg3 = arg1; + } else { + console.log( '不正 ' + arg1 ); + console.dir( arg1 ); + return; + }; + + if( X.Type.isArray( arg3 )){ + obj.s = arg3; + }; + return ( obj.x || obj.s ) ? obj : arg1; +}; + +function X_Callback_proxyCallback( xfunc, _args ){ + var args = _args || [], + thisObj = xfunc.x, + func = xfunc.f, + supp = xfunc.s, + temp, ret; + + if( supp && supp.length ){ + temp = []; + args.length && + ( + args.length === 1 ? + ( temp[ 0 ] = args[ 0 ] ) : + temp.push.apply( temp, args ) + ); + supp.length === 1 ? + ( temp[ temp.length ] = supp[ 0 ] ) : + temp.push.apply( temp, supp ); + args = temp; + }; + + switch( xfunc.k ){ + + case X_Callback_THIS_FUNC : + return args.length === 0 ? func.call( thisObj ) : func.apply( thisObj, args ); + + case X_Callback_HANDLEEVENT : + temp = thisObj[ 'handleEvent' ]; + if( X.Type.isFunction( temp ) ){ + return args.length === 0 ? thisObj[ 'handleEvent' ]() : + args.length === 1 ? thisObj[ 'handleEvent' ]( args[ 0 ] ) : temp.apply( thisObj, args ); + }; + break; + /* + if( temp !== func && X.Type.isFunction( temp ) ){ + return args.length === 0 ? thisObj[ 'handleEvent' ]() : temp.apply( thisObj, args ); + } else + if( X.Type.isFunction( thisObj ) ){ + return args.length === 0 ? thisObj.call( thisObj ) : thisObj.apply( thisObj, args ); + }; + return args.length === 0 ? func.call( thisObj ) : func.apply( thisObj, args );*/ + + case X_Callback_FUNC_ONLY : + return args.length === 0 ? + func() : + args.length === 1 ? + func( args[ 0 ] ) : + func.apply( null, args ); + }; + return X_Callback_NONE; +}; + +function X_Callback_same( arg1, arg2, arg3 ){ + var hash; + + if( arg1 && arg1[ 'kill' ] === X_Callback_kill ) return this === arg1; + + hash = X_Callback_classifyCallbackArgs( arg1, arg2, arg3 ); + + return hash && this.k === hash.k && this.x === hash.x && this.f === hash.f && this.s === hash.s; +}; + +function X_Callback_kill(){ + X_Callback_correct( this ); +}; + +function X_Callback_correct( f ){ + var i = X_Callback_LIVE_LIST.indexOf( f ), + obj; + if( i !== -1 ){ + X_Callback_LIVE_LIST.splice( i, 1 ); + X_Callback_POOL_LIST[ X_Callback_POOL_LIST.length ] = f; + obj = f( X_Closure_COMMAND_BACK ); + delete obj.k; + if( obj.f ) delete obj.f; + if( obj.x ) delete obj.x; + if( obj.s ) delete obj.s; + return true; + }; + return false; +}; diff --git a/0.6.x/js/01_core/11_XClass.js b/0.6.x/js/01_core/11_XClass.js index db37581..86b1e23 100644 --- a/0.6.x/js/01_core/11_XClass.js +++ b/0.6.x/js/01_core/11_XClass.js @@ -38,7 +38,7 @@ X.Class = { SINGLETON : 32, // 未実装 create : function( /* displayName, classSetting, opt_PrivateClass, props */ ){ - var args = X.copyArray( arguments ), + var args = X_Object_cloneArray( arguments ), displayName = args[ 0 ], classSetting, opt_pool, opt_abstract, opt_final, opt_private, @@ -194,7 +194,7 @@ function X_Class_getClassDef( KlassOrInstance ){ }; function X_Class_newPrivate( /* instance, args */ ){ - var args = X.copyArray( arguments ), + var args = X_Object_cloneArray( arguments ), user = args.shift(), def = X_Class_getClassDef( user ), privateClass = def.privateClass, @@ -262,7 +262,7 @@ function X_Class_subClassOf( klass ){ * http://d.hatena.ne.jp/m-hiyama/20051018/1129605002 */ function X_Class_inherits( /* displayName, classSetting, opt_PrivateClass, props */ ){ - var args = X.copyArray( arguments ), + var args = X_Object_cloneArray( arguments ), params = [], Super = this, superDef = X_Class_getClassDef( Super ), diff --git a/0.6.x/js/01_core/13_XEventDispatcher.js b/0.6.x/js/01_core/13_XEventDispatcher.js index 426a05d..970b3f6 100644 --- a/0.6.x/js/01_core/13_XEventDispatcher.js +++ b/0.6.x/js/01_core/13_XEventDispatcher.js @@ -22,38 +22,8 @@ // ------------------------------------------------------------------------- // var X_EventDispatcher_once = false, X_EventDispatcher_needsIndex = false, - X_EventDispatcher_temp = {}, - X_EventDispatcher_safariPreventDefault = false; // // Safari3- - -if( X.UA.MacIE ){ - X_EventDispatcher_temp.DOM_W3C = true; - X_EventDispatcher_temp.EVENT_DOM0 = true; -} else -if( X.UA.IE4 ){ // ie4 & iemobi4 - X_EventDispatcher_temp.DOM_IE4 = true; - X_EventDispatcher_temp.EVENT_DOM0 = true; -} else -if( document.getElementById ){ - X_EventDispatcher_temp.DOM_W3C = true; - if( document.addEventListener ){ - X_EventDispatcher_temp.EVENT_W3C = true; - } else - if( document.attachEvent ){ - X_EventDispatcher_temp.EVENT_IE = true; - } else { - X_EventDispatcher_temp.EVENT_DOM0 = true; - }; -} else -if( document.all ){ - X_EventDispatcher_temp.DOM_IE4 = true; - X_EventDispatcher_temp.EVENT_DOM0 = true; -} else -if( document.layers ){ - -} else { - -}; + X_EventDispatcher_safariPreventDefault = false; // Safari3- // ------------------------------------------------------------------------- // // --- interface ----------------------------------------------------------- // @@ -211,7 +181,7 @@ X.EventDispatcher = if( opt_arg1.k ){ hash = opt_arg1; } else { - hash = X.Callback._classifyCallbackArgs( opt_arg1, opt_arg2, opt_arg3, this ); + hash = X_Callback_classifyCallbackArgs( opt_arg1, opt_arg2, opt_arg3, this ); }; if( ( unlistens = this._unlistens ) && ( unlistens = unlistens[ opt_type ] ) ){ @@ -252,9 +222,9 @@ X.EventDispatcher = */ function X_EventDispatcher_dispatch( e ){ var list = this[ '_listeners' ], - ret = X.Callback.NONE, + ret = X_Callback_NONE, type = e[ 'type' ], - unlistens, i, l, f, r, sysOnly; + unlistens, i, l, args, f, r, sysOnly; if( !list || !( list = list[ type || e ] ) ) return ret; @@ -279,15 +249,14 @@ function X_EventDispatcher_dispatch( e ){ }; if( unlistens && unlistens.indexOf( f ) !== -1 ) continue; - r = X.Callback.NONE; + r = X_Callback_NONE; if( f.k ){ - f.a = [ e ]; - r = X.Callback._proxyCallback( f ); + r = X_Callback_proxyCallback( f, args || ( args = [ e ] ) ); } else { r = f.call( this, e ); }; - if( f.once || r & X.Callback.UN_LISTEN ){ + if( f.once || r & X_Callback_UN_LISTEN ){ // dispatch 中に unlisten が作られることがある if( !unlistens ){ unlistens = this._unlistens || ( this._unlistens = {} ); @@ -372,7 +341,7 @@ function X_EventDispatcher_listen( type, opt_arg1, opt_arg2, opt_arg3 ){ add && X_EventDispatcher_actualAddEvent( this, type, raw, list ); - f = X.Callback._classifyCallbackArgs( opt_arg1, opt_arg2, opt_arg3, this ); + f = X_Callback_classifyCallbackArgs( opt_arg1, opt_arg2, opt_arg3, this ); list[ list.length ] = f; f.once = X_EventDispatcher_once; @@ -396,6 +365,9 @@ function X_EventDispatcher_unlisten( opt_type, opt_arg1, opt_arg2, opt_arg3 ){ if( X.Type.isArray( opt_type ) ){ for( i = opt_type.length; i; ){ this.unlisten( opt_type[ --i ], opt_arg1, opt_arg2, opt_arg3 ); + if( !opt_type[ i ] ){ + alert( '不正な unlisten Array' ); + }; }; return this; }; @@ -443,12 +415,12 @@ function X_EventDispatcher_unlisten( opt_type, opt_arg1, opt_arg2, opt_arg3 ){ ( this._unlistens[ opt_type ] = [ f ] ); } else { delete f.once; - // f.kill === X.Callback._kill && f.kill(); + // f.kill === X_Callback_kill && f.kill(); _list.splice( i, 1 ); if( !_list.length ){ raw = this._rawObject || this._ie4getRawNode && this._ie4getRawNode(); delete list[ opt_type ]; - if( empty = X.isEmptyObject( list ) ) delete this._listeners; + if( empty = X_Object_isEmpty( list ) ) delete this._listeners; if( raw && '' + parseFloat( opt_type ) !== '' + opt_type ){ // 数字イベントの除外 X_EventDispatcher_actualRemoveEvent( this, opt_type, raw, _list, !empty ); }; @@ -462,7 +434,7 @@ var X_EventDispatcher_actualAddEvent = // Days on the Moon DOM Events とブラウザの実装 // http://nanto.asablo.jp/blog/2007/03/23/1339502 // Safari 2 では関数オブジェクトしか EventListener として使えませんが、Safari のナイトリービルドでは handleEvent メソッドを持つオブジェクトも EventListener として使えるようです。 - X_EventDispatcher_temp.EVENT_W3C /* && ( X.UA.WebKit < 525.13 || X.UA.Opera7 || X.UA.NetFront < 4 ) */ ? // Safari3- + X_UA_EVENT.W3C /* && ( X.UA.WebKit < 525.13 || X.UA.Opera7 || X.UA.NetFront < 4 ) */ ? // Safari3- (function( that, type, raw, list ){ var i; @@ -473,10 +445,10 @@ var X_EventDispatcher_actualAddEvent = X_EventDispatcher_actualAddEvent( that, type[ --i ], raw, list ); }; } else { - that._handleEvent || ( that._handleEvent = X.Callback.create( that, X_EventDispatcher_actualHandleEvent ) ); + that._handleEvent || ( that._handleEvent = X_Callback_create( that, X_EventDispatcher_actualHandleEvent ) ); if( that._isSilverlight ){ - list.slcallback = X.Callback.create( that, X_EventDispatcher_sliverLightDispatch, [ type ] ); + list.slcallback = X_Callback_create( that, X_EventDispatcher_sliverLightDispatch, [ type ] ); list.sltoken = raw.AddEventListener( type, list.slcallback ); } else if( raw.addEventListener ){ @@ -487,7 +459,7 @@ var X_EventDispatcher_actualAddEvent = }; }; }) : - X_EventDispatcher_temp.EVENT_IE ? + X_UA_EVENT.IE ? (function( that, type, raw, list ){ var i; //if( type === 'load' && that._tag && X.Dom.Event._LOAD_FIX_TAGS[ that._tag ] ){ @@ -495,7 +467,7 @@ var X_EventDispatcher_actualAddEvent = //}; if( that._isXHR ){ // ie8- の XHR は window.event が更新されないため, eventType 毎に callback を指定する - raw[ 'on' + type ] = X.Callback.create( that, X_EventDispatcher_dispatch, [ type ] ); + raw[ 'on' + type ] = X_Callback_create( that, X_EventDispatcher_dispatch, [ type ] ); } else { type = X.Dom.Event.Rename[ type ] || type; @@ -504,10 +476,10 @@ var X_EventDispatcher_actualAddEvent = X_EventDispatcher_actualAddEvent( that, type[ --i ], raw, list ); }; } else{ - that._handleEvent || ( that._handleEvent = X.Callback.create( that, X_EventDispatcher_actualHandleEvent ) ); + that._handleEvent || ( that._handleEvent = X_Callback_create( that, X_EventDispatcher_actualHandleEvent ) ); if( that._isSilverlight ){ - list.slcallback = X.Callback.create( that, X_EventDispatcher_sliverLightDispatch, [ type ] ); + list.slcallback = X_Callback_create( that, X_EventDispatcher_sliverLightDispatch, [ type ] ); list.sltoken = raw.AddEventListener( type, list.slcallback ); } else if( raw.attachEvent ){ @@ -527,10 +499,10 @@ var X_EventDispatcher_actualAddEvent = X_EventDispatcher_actualAddEvent( that, type[ --i ], raw, list ); }; } else { - that._handleEvent || ( that._handleEvent = X.Callback.create( that, X_EventDispatcher_actualHandleEvent ) ); + that._handleEvent || ( that._handleEvent = X_Callback_create( that, X_EventDispatcher_actualHandleEvent ) ); if( that._isSilverlight ){ - list.slcallback = X.Callback.create( that, X_EventDispatcher_sliverLightDispatch, [ type ] ); + list.slcallback = X_Callback_create( that, X_EventDispatcher_sliverLightDispatch, [ type ] ); list.sltoken = raw.AddEventListener( type, list.slcallback ); } else { raw[ 'on' + type ] = that._handleEvent; @@ -547,7 +519,7 @@ function X_EventDispatcher_sliverLightDispatch( sender, e, type ){ }; var X_EventDispatcher_actualRemoveEvent = - X_EventDispatcher_temp.EVENT_W3C /*&& ( X.UA.WebKit < 525.13 || X.UA.Opera7 || X.UA.NetFront < 4 )*/ ? // Safari3- + X_UA_EVENT.W3C /*&& ( X.UA.WebKit < 525.13 || X.UA.Opera7 || X.UA.NetFront < 4 )*/ ? // Safari3- (function( that, type, raw, list, skip ){ type = X.Dom.Event.Rename[ type ] || type; @@ -559,7 +531,7 @@ var X_EventDispatcher_actualRemoveEvent = if( that._isSilverlight ){ raw.RemoveEventListener( type, list.sltoken ); // token - X.Callback._correct( list.slcallback ); + X_Callback_correct( list.slcallback ); delete list.sltoken; delete list.slcallback; } else { @@ -569,20 +541,20 @@ var X_EventDispatcher_actualRemoveEvent = raw[ 'on' + type ] = null; }; if( !skip ){ - X.Callback._correct( that._handleEvent ); + X_Callback_correct( that._handleEvent ); delete that._handleEvent; }; }; }; }) : - X_EventDispatcher_temp.EVENT_IE ? + X_UA_EVENT.IE ? (function( that, type, raw, list, skip ){ var i; //if( type === 'load' && that._tag && X.Dom.Event._LOAD_FIX_TAGS[ that._tag ] ){ // type = 'readystatechange'; //}; if( that._isXHR ){ - X.Callback._correct( raw[ 'on' + type ] ); + X_Callback_correct( raw[ 'on' + type ] ); raw[ 'on' + type ] = X.emptyFunction; raw[ 'on' + type ] = ''; } else { @@ -596,7 +568,7 @@ var X_EventDispatcher_actualRemoveEvent = if( that._isSilverlight ){ raw.RemoveEventListener( type, list.sltoken ); // token - X.Callback._correct( list.slcallback ); + X_Callback_correct( list.slcallback ); delete list.sltoken; delete list.slcallback; } else { @@ -608,7 +580,7 @@ var X_EventDispatcher_actualRemoveEvent = }; if( !skip ){ - X.Callback._correct( that._handleEvent ); + X_Callback_correct( that._handleEvent ); delete that._handleEvent; }; }; @@ -626,7 +598,7 @@ var X_EventDispatcher_actualRemoveEvent = if( that._isSilverlight ){ raw.RemoveEventListener( type, list.sltoken ); // token - X.Callback._correct( list.slcallback ); + X_Callback_correct( list.slcallback ); delete list.sltoken; delete list.slcallback; } else { @@ -634,7 +606,7 @@ var X_EventDispatcher_actualRemoveEvent = raw[ 'on' + type ] = ''; if( !skip ){ - X.Callback._correct( that._handleEvent ); + X_Callback_correct( that._handleEvent ); delete that._handleEvent; }; }; @@ -646,7 +618,7 @@ var X_EventDispatcher_actualRemoveEvent = // Is this in regard to the Safari 1.x preventDefault bug on click/dblclick? // https://groups.google.com/forum/#!msg/comp.lang.javascript/uYEuCHjHxnw/yKoHtZJPa1QJ var X_EventDispatcher_actualHandleEvent = - X.UA.IE4 || X_EventDispatcher_temp.EVENT_IE ? // ie45678 EVENT_IE & EVENT_DOM0 for ie4 + X_UA_EVENT.IE4 || X_UA_EVENT.IE ? // ie45678 EVENT_IE & EVENT_DOM0 for ie4 (function(){ var ret; @@ -664,10 +636,10 @@ var X_EventDispatcher_actualHandleEvent = return event.returnValue = false; }; }) : - //X.Dom.EVENT_W3C & EVENT_DOM0 + //X_UA_EVENT.W3C & X_UA_EVENT.DOM0 (function( e ){ var ev = new X.Dom.Event( e, this ), - ret = X.Callback.NONE, + ret = X_Callback_NONE, i, l; // touch event -> pointer diff --git a/0.6.x/js/01_core/14_XTimer.js b/0.6.x/js/01_core/14_XTimer.js index 0ab0bd4..0725037 100644 --- a/0.6.x/js/01_core/14_XTimer.js +++ b/0.6.x/js/01_core/14_XTimer.js @@ -83,7 +83,7 @@ X.Timer = { opt_count = 0; }; - hash = X.Callback._classifyCallbackArgs( args1, args2, args3 ); + hash = X_Callback_classifyCallbackArgs( args1, args2, args3 ); if( !hash ) return -1; // dev only if( !hash.k ) hash = { f : hash }; @@ -127,14 +127,14 @@ X.Timer = { var i = X_Timer_REQ_FRAME_LIST.length, f; i === 0 && ( X_Timer_requestID = X_Timer_REQ_ANIME_FRAME( X_Timer_onEnterFrame ) ); - f = X_Timer_REQ_FRAME_LIST[ i ] = X.Callback._classifyCallbackArgs( args1, args2, args3 ); + f = X_Timer_REQ_FRAME_LIST[ i ] = X_Callback_classifyCallbackArgs( args1, args2, args3 ); return f.uid = ++X_Timer_uid; }) : (function( args1, args2, args3 ){ var i = X_Timer_REQ_FRAME_LIST.length, f; i === 0 && ( X_Timer_requestID = X.Timer.add( 0, 1, X_Timer_onEnterFrame ) ); - f = X_Timer_REQ_FRAME_LIST[ i ] = X.Callback._classifyCallbackArgs( args1, args2, args3 ); + f = X_Timer_REQ_FRAME_LIST[ i ] = X_Callback_classifyCallbackArgs( args1, args2, args3 ); return f.uid = ++X_Timer_uid; }), @@ -217,8 +217,8 @@ function X_Timer_onTimeout(){ c = q.count; if( q.k ){ - q.a = []; - r = X.Callback._proxyCallback( q ); + //q.a = []; + r = X_Callback_proxyCallback( q, [] ); } else { r = q.f(); }; @@ -231,7 +231,7 @@ function X_Timer_onTimeout(){ heavy = true; }; - if( r & X.Callback.UN_LISTEN || c === 1 ){ + if( r & X_Callback_UN_LISTEN || c === 1 ){ list.splice( i, 1 ); --i; --l; @@ -291,7 +291,7 @@ if( X.UA.iOS ){ function X_Timer_onEnterFrame( time ){ var list = X_Timer_REQ_FRAME_LIST, l = list.length, - i = 0, q, uid; + i = 0, q, uid, args; time = time || X.getTime(); X_Timer_busyOnFrame = true; @@ -302,8 +302,7 @@ function X_Timer_onEnterFrame( time ){ if( X_Timer_removal && X_Timer_removal[ q.uid ] ) continue; if( q.k ){ - q.a = [ time ]; - X.Callback._proxyCallback( q ); + X_Callback_proxyCallback( q, args || ( args = [ time ] ) ); } else { q( time ); }; diff --git a/0.6.x/js/02_dom/00_XDom.js b/0.6.x/js/02_dom/00_XDom.js index e5b2ebf..22a96cf 100644 --- a/0.6.x/js/02_dom/00_XDom.js +++ b/0.6.x/js/02_dom/00_XDom.js @@ -1,11 +1,9 @@ - - X.Dom = X.Class._override( new X.EventDispatcher(), { readyState : -1, - active : !!window.parent || !!document.activeElement, // frameに読み込まれた場合のieのerror回避 + active : !!window.parent || !!document.activeElement, // parent は frameに読み込まれた場合のieのerror回避 _root : null, _lock : false, @@ -29,7 +27,7 @@ X.Dom = X.Class._override( * * http://sssslide.com/www.slideshare.net/hiroakiwakamatsu/javascript-14514208 * 1. 傾き時の画面サイズ取得ー 対処方法の例 - * (1)ー• タイマーを使って、画面サイズ取得の タイミングを少しだけ遅延させる + * (1)ー? タイマーを使って、画面サイズ取得の タイミングを少しだけ遅延させる * window.onorientationchange = function() { setTimeout(function() { alert("W: " + window.innerWidth + ", H: " + window.innerHeight); }, 200); } * 横に傾けた時、正常に横向け時の 幅と高さが取得できている ただし、端末によってはうまく取得できな い場合がある(Galaxy S IIIとか・・・) 7 * @@ -87,7 +85,7 @@ X.Dom = X.Class._override( _init : function(){ var s, size, html, head, body; - if( X.Dom.Event.DOM_PRE_INIT <= X.Dom.readyState ) return X.Callback.UN_LISTEN; + if( X.Dom.Event.DOM_PRE_INIT <= X.Dom.readyState ) return X_Callback_UN_LISTEN; console.log( 'X.Dom._init()' ); @@ -102,16 +100,16 @@ X.Dom = X.Class._override( html = Node._html = document.documentElement ? new Node( document.documentElement ) : - X.Dom.DOM_W3C ? + X_UA_DOM.W3C ? new Node( document.getElementsByTagName( 'html' )[ 0 ] ) : - X.Dom.DOM_IE4 ? + X_UA_DOM.IE4 ? new Node( document.all.tags( 'html' )[ 0 ] ) : null; head = Node._head = - X.Dom.DOM_W3C ? + X_UA_DOM.W3C ? new Node( document.getElementsByTagName( 'head' )[ 0 ] ) : - X.Dom.DOM_IE4 ? + X_UA_DOM.IE4 ? new Node( document.all.tags( 'head' )[ 0 ] ) : null; @@ -131,7 +129,7 @@ X.Dom = X.Class._override( X.Dom.listenOnce( X.Dom.Event.DOM_PRE_INIT, function(){ X.Dom.readyState = X.Dom.Event.DOM_BUILDER_COMPLETE; - !X.Dom._useBuilder && X.Dom.asyncDispatch( 0, { type : X.Dom.Event.DOM_BUILDER_COMPLETE } ); + !X_TEMP.X_Dom_useBuilder && X.Dom.asyncDispatch( 0, { type : X.Dom.Event.DOM_BUILDER_COMPLETE } ); } ); X.Dom.listenOnce( X.Dom.Event.DOM_BUILDER_COMPLETE, function(){ @@ -188,7 +186,7 @@ X.Dom = X.Class._override( .listen( 'blur', X.Dom ); }; - return X.Callback.UN_LISTEN; + return X_Callback_UN_LISTEN; }, handleEvent : function( e ){ @@ -318,123 +316,6 @@ if( !( X.UA.IE < 9 || X.UA.iOS ) ){ }; }; -/* - * http://d.hatena.ne.jp/t-uchima/20051003/p1 - * MacIEにはattachEventが一応あるけどwindow.attachEventとdocument.attachEventしかなく他の要素にはattachEventはない。 - */ -if( X.UA.MacIE ){ - X.Dom.DOM_W3C = true; - X.Dom.EVENT_DOM0 = true; -} else -if( X.UA.IE4 ){ // ie4 & iemobi4 - X.Dom.DOM_IE4 = true; - X.Dom.EVENT_DOM0 = true; -} else -if( document.getElementById ){ - X.Dom.DOM_W3C = true; - if( document.addEventListener ){ - X.Dom.EVENT_W3C = true; - } else - if( document.attachEvent ){ - X.Dom.EVENT_IE = true; - } else { - X.Dom.EVENT_DOM0 = true; - }; -} else -if( document.all ){ - X.Dom.DOM_IE4 = true; - X.Dom.EVENT_DOM0 = true; -} else -if( document.layers ){ - -} else { - -}; - -X.Dom.EVENT_POINTER = navigator.msPointerEnabled || navigator.pointerEnabled; -X.Dom.EVENT_TOUCH = !X.Dom.EVENT_POINTER && window.ontouchstart !== undefined; - - - -X.Dom.CRLF = String.fromCharCode( 13 ) + String.fromCharCode( 10 ); - -X.Dom.cleanupWhiteSpace = function( text ){ - var _ = ' ', __ = ' ', CRLF = X.Dom.CRLF; - //text.indexOf( CRLF ) !== -1 && ( text = text.split( CRLF ).join( _ ) ); - text.indexOf( '\n\r' ) !== -1 && ( text = text.split( '\n\r' ).join( _ ) ); - text.indexOf( '\t' ) !== -1 && ( text = text.split( '\t' ).join( _ ) ); - text.indexOf( '\r' ) !== -1 && ( text = text.split( '\r' ).join( _ ) ); - text.indexOf( '\n' ) !== -1 && ( text = text.split( '\n' ).join( _ ) ); - text.indexOf( '\f' ) !== -1 && ( text = text.split( '\f' ).join( _ ) ); - text.indexOf( '\b' ) !== -1 && ( text = text.split( '\b' ).join( _ ) ); - while( text.indexOf( __ ) !== -1 ){ - text = text.split( __ ).join( _ ); - }; - return text; -}; - -X.Dom.whiteSpaceToTag = function( text ){ - if( text == null ) return ''; - return text.toString() - //.split( '\r\n\r\n' ).join( '
' ) - //.split( '\n\r\n\r' ).join( '
' ) - //.split( '\r\n' ).join( '
' ) - .split( '\n\r' ).join( '
' ) - .split( '\r' ).join( '
' ) - .split( '\n' ).join( '
' ) - .split( '\t' ).join( '    ' ) - .split( '\f' ).join( '' ) - .split( '\b' ).join( '' ); -}; - -X.Dom.chrReferanceTo = function( str ){ - if( str == null ) return ''; - return str.toString() - .split( '&' ).join( '&' ) - .split( '<' ).join( '<' ) - .split( '>' ).join( '>' ) - .split( ' ' ).join( ' ' ); -}; - -/* - * original - * AS3で相対パスを絶対パスに変換する - * http://www.shin-go.net/motionlab/?p=449 - */ -X.Dom.baseURL = ( function( parts ){ - var last = 1 < parts.length && parts[ parts.length - 1 ]; - if( last !== false && ( last === '' || //末尾が/で終わるとき - last.indexOf( '.' ) !== -1 ) ){//末尾がファイル名で終わる時 - - --parts.length; - }; - return parts.join( '/' ); -})( location.href.split( '?' )[ 0 ].split( '#' )[ 0 ].split( '/' ) ); - -X.Dom.getAbsolutePath = function( path ){ - var s = '/', - ss = '//', - _ary, ary, i = 0; - - if( 'http:file:https:'.indexOf( path.substr( 0, 4 ) ) !== -1 ) return path; - - _ary = X.Dom.baseURL.split( ss ); - ary = _ary[ 1 ].split( s ); - - if( path.charAt( 0 ) === s ) return [ _ary[ 0 ], ss, ary[ 0 ], path ].join( '' ); - - if( path.substr( 0, 2 ) === './' ){ - path = path.substr( 2 ); - } else { - while( path.substr( i, 3 ) === '../' ){ - --ary.length; - i += 3; - }; - if( i ) path = path.substr( i ); - }; - return [ _ary[ 0 ], ss, ary.join( s ), s, path ].join( '' ); -}; - if( window[ 'orientation' ] !== undefined ){ X.Dom._orientationchange = function( e ){ X.Dom._orientationFlag = true; @@ -443,5 +324,4 @@ if( window[ 'orientation' ] !== undefined ){ }; }; - -console.log( 'X.Dom dom:w3c=' + X.Dom.DOM_W3C + ' ev:w3c=' + X.Dom.EVENT_W3C ); +console.log( 'X.Dom dom:w3c=' + X_UA_DOM.W3C + ' ev:w3c=' + X_UA_EVENT.W3C ); diff --git a/0.6.x/js/02_dom/01_XDomDTD.js b/0.6.x/js/02_dom/01_XDomDTD.js index 07c2432..e7d98b2 100644 --- a/0.6.x/js/02_dom/01_XDomDTD.js +++ b/0.6.x/js/02_dom/01_XDomDTD.js @@ -1,8 +1,5 @@ - -/* なんで */ -X.Dom.DTD = { - - EMPTY : { + +var X_Dom_DTD_EMPTY = { AREA : true, BASE : true, BASEFONT : true, @@ -19,15 +16,17 @@ X.Dom.DTD = { EMBED : true }, - TAG_FIX : - X.UA.IE && 4 <= X.UA.IE && X.UA.IE < 5 ? + /* + * TODO html5 要素, audio, video は? + */ + X_Dom_DTD_TAG_FIX = + X_UA.IE4 ? { ABBR : 'ACRONYM', BDO : '', RUBY : '' } : - X.UA.IE && 5 <= X.UA.IE && X.UA.IE < 7 ? + X_UA.IE5 || X_UA.IE55 || X_UA.IE6 ? { ABBR : 'ACRONYM' } : {}, - // video:1,audio:1} - ATTR_VAL_IS_URI : { + X_Dom_DTD_ATTR_VAL_IS_URI = { action : true, archive : true, background : true, @@ -40,36 +39,46 @@ X.Dom.DTD = { profile : true, src : true, usemap : true - } -}; - -X.Dom.moveToHead = { - STYLE : true, - LINK : true, - TITLE : true, - BGSOUND : true, - AREA : true, - BASE : true, - META : true -}; + }, + + X_Dom_DTD_MOVE_TO_HEAD = { + STYLE : true, + LINK : true, + TITLE : true, + BGSOUND : true, + AREA : true, + BASE : true, + META : true + }, + + X_Dom_DTD_CLEANUP_TAGS = { + SCRIPT : true, + NOSCRIPT : true, + NOFRAMES : true, + '!' : true, // ie + COMMENT : true, // ie + NOEMBED : true, + NOLAYER : true + }, + + X_Dom_DTD_SKIP_CLEANUP_TAGS = { + PRE : true, + TEXTAREA : true, + CODE : true, + KBD : true, + SAMP : true, + XMP : true, + PLAINTEXT : true, + LISTING : true + }; +/* +X.Dom.DTD = { + + EMPTY : X_Dom_DTD_EMPTY, + + TAG_FIX : X_Dom_DTD_TAG_FIX, -X.Dom.cleanupTagNames = { - SCRIPT : true, - NOSCRIPT : true, - NOFRAMES : true, - '!' : true, // ie - COMMENT : true, // ie - NOEMBED : true, - NOLAYER : true + ATTR_VAL_IS_URI : X_Dom_DTD_ATTR_VAL_IS_URI }; +*/ -X.Dom.skipCleanupTagNames = { - PRE : true, - TEXTAREA : true, - CODE : true, - KBD : true, - SAMP : true, - XMP : true, - PLAINTEXT : true, - LISTING : true -}; diff --git a/0.6.x/js/02_dom/02_XDomNode.js b/0.6.x/js/02_dom/02_XDomNode.js index 34a41c8..ecacc7a 100644 --- a/0.6.x/js/02_dom/02_XDomNode.js +++ b/0.6.x/js/02_dom/02_XDomNode.js @@ -25,7 +25,7 @@ X.Dom.State = { HAS_HEIGHT_LENGTH : 512, HAS_HEIGHT_PERCENT : 1024, IE4_ONLY_TEXT : 2048, - IE5_DISPLAY_NONE_FIX : !X.UA.MacIE && 5 <= X.UA.IE && X.UA.IE < 5.5 ? 4096 : 0 // filterがかかっていると不可? MacIE5.2- は ? + IE5_DISPLAY_NONE_FIX : !X.UA.MacIE && X.UA.IE5 ? 4096 : 0 // filterがかかっていると不可? MacIE5.2- は ? }; X.Dom._strictElmCreation = !X.UA.MacIE && X.UA.IE5678;// && !X.UA.MacIE; @@ -115,7 +115,7 @@ X.Dom.Node = X.EventDispatcher.inherits( // X.Dom.Dirty.CSS を落とす this._dirty = 0; // attr の回収は不可能、、、 - if( X.Dom.DOM_IE4 ){ + if( X_UA_DOM.IE4 ){ v.setAttribute( 'UID', '' + uid ); } else { v.UID = uid; @@ -201,7 +201,7 @@ Node._getXNode = function( v ){ case Node.IS_RAW_HTML : case Node.IS_IMAGE : // fake TextNode too. - if( X.Dom.DOM_IE4 ){ + if( X_UA_DOM.IE4 ){ uid = v.getAttribute( 'UID' ); return uid && Node._chashe[ uid ]; }; @@ -245,7 +245,7 @@ Node.getRoot = function( xnode ){ }; // XMLかどうかを判別する Node.isXmlDocument = - X.Dom.DOM_IE4 ? + X_UA_DOM.IE4 ? X.emptyFunction : (function( root ){ if( X.Type.isBoolean( root.isXML ) ) return root.isXML; @@ -263,7 +263,7 @@ Node._systemNode = null; // = Node._chashe[ ? ] Node._reserveRemoval = []; -if( X.Dom.DOM_IE4 ){ +if( X_UA_DOM.IE4 ){ Node.prototype._ie4getRawNode = function(){ var elm = this._rawObject; return elm || @@ -326,7 +326,7 @@ Node.prototype.clone = function( opt_clone_children ){ switch( this._xnodeType ){ case 1 : Node._newByTag = true; - xnode = new Node( this._tag, X.cloneObject( this._attrs ), X.cloneObject( this._css ) ) + xnode = new Node( this._tag, X_Object_clone( this._attrs ), X_Object_clone( this._css ) ) .attr( { 'id' : this._id } ) .className( this._className ); if( opt_clone_children && ( xnodes = this._xnodes ) && ( l = xnodes.length ) ){ @@ -376,10 +376,10 @@ Node.prototype.append = function( v ){ if( v._xnodeType !== 1 && v._xnodeType !== 3 ) return this; // 親の xnodes から v を消す if( v.parent ){ - //if( X.Dom.DOM_W3C ){ + //if( X_UA_DOM.W3C ){ // v.parent._xnodes.splice( v.parent._xnodes.indexOf( v ), 1 ); //} else - //if( X.Dom.DOM_IE4 ){ + //if( X_UA_DOM.IE4 ){ v.remove(); //} else { @@ -440,10 +440,10 @@ Node.prototype.appendAt = function( start, v ){ if( v._xnodeType !== 1 && v._xnodeType !== 3 ) return this; // 親の xnodes から v を消す if( v.parent ){ - //if( X.Dom.DOM_W3C ){ + //if( X_UA_DOM.W3C ){ // v.parent._xnodes.splice( v.parent._xnodes.indexOf( v ), 1 ); //} else - //if( X.Dom.DOM_IE4 ){ + //if( X_UA_DOM.IE4 ){ v.remove(); //} else { @@ -794,7 +794,7 @@ Node.prototype.html = function( html ){ }; if( Node._outerFlag === this ) Node._outerFlag = null; }; - !Node._outerFlag || X.Dom.DTD.EMPTY[ this._tag ] || ( html[ n ] = '<\/' + this._tag + '>' ); + !Node._outerFlag || X_Dom_DTD_EMPTY[ this._tag ] || ( html[ n ] = '<\/' + this._tag + '>' ); return html.join( _ ); }; @@ -842,7 +842,7 @@ Node.prototype.call = function( name /*, opt_args... */ ){ func = raw[ name ]; if( X.Type.isFunction( func ) ){ if( l ){ - args = X.copyArray( arguments ); + args = X_Object_cloneArray( arguments ); args.shift(); return func.apply( raw, args ); }; @@ -852,7 +852,7 @@ Node.prototype.call = function( name /*, opt_args... */ ){ // typeof func === unknown に対策 // http://la.ma.la/blog/diary_200509031529.htm if( l ){ - args = X.copyArray( arguments ); + args = X_Object_cloneArray( arguments ); args.shift(); params = []; @@ -876,7 +876,7 @@ Node.prototype.call = function( name /*, opt_args... */ ){ Node.prototype.each = function( func /*, opt_args */ ){ var args; if( 1 < arguments.length ){ - args = X.copyArray( arguments ); + args = X_Object_cloneArray( arguments ); args[ 0 ] = 0; func.apply( this, args ); } else { @@ -948,7 +948,7 @@ Node.prototype._startUpdate = function(){ }; Node.prototype._commitUpdate = - X.Dom.DOM_W3C ? + X_UA_DOM.W3C ? ( function( parentElement, nextElement ){ var elm = this._rawObject, xnodes, l, i, frg, next, k, v; @@ -993,7 +993,7 @@ Node.prototype._commitUpdate = }; return elm; }) : - X.Dom.DOM_IE4 ? + X_UA_DOM.IE4 ? ( function( parentElement, prevElement ){ var elm = this._rawObject || this._ie4getRawNode(), xnodes, l, i, html, text, prev; @@ -1041,13 +1041,13 @@ Node.prototype._commitUpdate = (function(){}); Node.prototype._updateRawNode = - X.Dom.DOM_W3C ? + X_UA_DOM.W3C ? ( function( elm ){ var attrs, rename, k, v; // textNode if( this._dirty & X.Dom.Dirty.CONTENT ){ - elm.data = X.Dom.chrReferanceTo( this._text ); + elm.data = X_String_chrReferanceTo( this._text ); delete this._dirty; return; }; @@ -1108,7 +1108,7 @@ Node.prototype._updateRawNode = delete this._dirty; }) : - X.Dom.DOM_IE4 ? + X_UA_DOM.IE4 ? ( function( elm ){ var attrs, rename, k, v; @@ -1151,7 +1151,9 @@ Node.prototype._updateRawNode = for( k in attrs ){ ( v = attrs[ k ] ) === undefined ? elm.removeAttribute( rename[ k ] || k ) : - elm.setAttribute( rename[ k ] || k, v ); // TODO X.Dom.Attr.noValue[ k ] ? k : v + this._tag === 'TEXTAREA' && k === 'value' ? + ( elm.innerText = v ) : + elm.setAttribute( rename[ k ] || k, X.Dom.Attr.noValue[ k ] ? k : v ); // TODO X.Dom.Attr.noValue[ k ] ? k : v }; delete this._newAttrs; }; @@ -1178,14 +1180,14 @@ Node.prototype._updateRawNode = * document.createElement of ie4 is only for OPTION & IMAGE. */ Node.prototype._actualCreate = - X.Dom.DOM_W3C ? (function( isChild ){ + X_UA_DOM.W3C ? (function( isChild ){ var elm = this._rawObject, xnodes, frg, i, l; if( this._xnodeType === 3 ){ if( elm ) return elm; delete this._dirty; - return this._rawObject = document.createTextNode( X.Dom.chrReferanceTo( this._text ) ); + return this._rawObject = document.createTextNode( X_String_chrReferanceTo( this._text ) ); }; if( !elm ){ @@ -1217,7 +1219,7 @@ Node.prototype._actualCreate = return elm; }) : - X.Dom.DOM_IE4 ? (function( isChild ){ + X_UA_DOM.IE4 ? (function( isChild ){ var uid = this._uid, html, xnodes, n, i, l; @@ -1252,7 +1254,7 @@ Node.prototype._actualCreate = }; }; }; - X.Dom.DTD.EMPTY[ this._tag ] || ( html[ n ] = '<\/' + this._tag + '>' ); + X_Dom_DTD_EMPTY[ this._tag ] || ( html[ n ] = '<\/' + this._tag + '>' ); delete this._newAttrs; }; @@ -1262,7 +1264,7 @@ Node.prototype._actualCreate = (function(){}); Node.prototype._afterActualCreate = - X.Dom.DOM_W3C ? (function(){ + X_UA_DOM.W3C ? (function(){ var elm = this._rawObject, xnodes, l, attrs, k, i; this._root = this.parent._root; @@ -1305,7 +1307,7 @@ Node.prototype._afterActualCreate = // ie の str から要素を作る場合、srcだけ イベント設定後ではないか? X_EventDispatcher_toggleAllEvents( this, true );// イベントの復帰 }) : - X.Dom.DOM_IE4 ? (function(){ + X_UA_DOM.IE4 ? (function(){ var xnodes, i; this._root = this.parent._root; @@ -1326,7 +1328,7 @@ Node.prototype._afterActualCreate = (function(){}); Node.prototype._actualRemove = - X.Dom.DOM_W3C ? + X_UA_DOM.W3C ? ( function( isChild ){ var xnodes = this._xnodes, elm = this._rawObject, @@ -1344,10 +1346,10 @@ Node.prototype._actualRemove = if( !X.UA.MacIE ){ !isChild && elm.parentNode && elm.parentNode.tagName && elm.parentNode.removeChild( elm ); } else { - !isChild && elm.parentNode && elm.parentNode.tagName && X.Dom._fixed_remove( elm, this ); + !isChild && elm.parentNode && elm.parentNode.tagName && X_TEMP._fixed_remove( elm, this ); }; }) : - X.Dom.DOM_IE4 ? + X_UA_DOM.IE4 ? ( function( isChild ){ var xnodes = this._xnodes, elm = this._rawObject || this._ie4getRawNode(), @@ -1361,7 +1363,7 @@ Node.prototype._actualRemove = if( !elm ) return; this._xnodeType === 1 && X_EventDispatcher_toggleAllEvents( this, false );// イベントの退避 - if( X.Dom.Attr.HAS_VALUE[ this._tag ] && ( !this._newAttrs || !X.inObject( 'value', this._newAttrs ) ) ){ + if( X.Dom.Attr.HAS_VALUE[ this._tag ] && ( !this._newAttrs || !X_Object_inObject( 'value', this._newAttrs ) ) ){ this._attrs.value = elm.value; }; elm.removeAttribute( 'id' ); // ? diff --git a/0.6.x/js/02_dom/03_XDomEvent.js b/0.6.x/js/02_dom/03_XDomEvent.js index 183090e..df7c725 100644 --- a/0.6.x/js/02_dom/03_XDomEvent.js +++ b/0.6.x/js/02_dom/03_XDomEvent.js @@ -12,11 +12,11 @@ // http://msdn.microsoft.com/ja-jp/library/ie/dn255104%28v=vs.85%29.aspx var X_Dom_Event_devicePixelRatio = window.devicePixelRatio || ( window.screen.deviceXDPI / window.screen.logicalXDPI ), - X_Dom_Event_convertMSPointerType = window.MSPointerEvent && { - 2 : 'touch', - 3 : 'pen', - 4 : 'mouse' - }; + X_Dom_Event_convertMSPointerType = window.MSPointerEvent && [ 0, 0, 'touch', 'pen', 'mouse' ];/*{ + '2' : 'touch', + '3' : 'pen', + '4' : 'mouse' + }; */ if( !X.UA.IE || 9 <= X.UA.IE ){ X.Dom.Event = function( e, xnode ){ @@ -340,7 +340,7 @@ X.Dom.Event._LOAD_FIX_TAGS = { X.Dom.Event.Rename = {}; X.Dom.Event.RenameTo = {}; -X.Dom.Event.toPointer = !X.Dom.EVENT_POINTER && ( X.Dom.EVENT_TOUCH ? +X.Dom.Event.toPointer = !X_UA_HID.POINTER && ( X_UA_HID.TOUCH ? { touchdown : 'pointerdown', mousedown : 'pointerdown', @@ -444,7 +444,7 @@ if( !navigator.pointerEnabled ){ X.Dom.Event.Rename[ 'pointercancel' ] = 'MSPointerCancel'; // http://msdn.microsoft.com/ja-jp/library/ie/dn304886%28v=vs.85%29.aspx } else - if( X.Dom.EVENT_TOUCH ){ + if( X_UA_HID.TOUCH ){ X.Dom.Event.Rename[ 'pointerdown' ] = [ 'touchdown', 'mousedown' ]; X.Dom.Event.Rename[ 'pointerup' ] = [ 'touchup', 'mouseup' ]; X.Dom.Event.Rename[ 'pointermove' ] = [ 'touchmove', 'mousemove' ]; @@ -486,7 +486,7 @@ if( !navigator.pointerEnabled ){ // http://shimax.cocolog-nifty.com/search/2006/09/safarijavascrip_c54d.html /* for ie9+/Mozilla/Opera9 */ -if( X.Dom.EVENT_W3C ){ +if( X_UA_EVENT.W3C ){ Node._document.listenOnce( 'DOMContentLoaded', X.Dom._init ); } else if( 6 <= X.UA.IE && X.inHead ){ @@ -508,7 +508,7 @@ if( 6 <= X.UA.IE && X.inHead ){ // http://lists.apple.com/archives/web-dev/2003/Oct/msg00036.html if( X.UA.WebKit || X.UA.Safari < 3 ){ // sniff X.Timer.add( 16, function(){ - if( !X.Dom._init ) return X.Callback.UN_LISTEN; + if( !X.Dom._init ) return X_Callback_UN_LISTEN; if( document.readyState === 'loaded' || document.readyState === 'complete' ) return X.Dom._init(); }); }; diff --git a/0.6.x/js/02_dom/04_XDomBoxModel.js b/0.6.x/js/02_dom/04_XDomBoxModel.js index 3d6f78f..923cc99 100644 --- a/0.6.x/js/02_dom/04_XDomBoxModel.js +++ b/0.6.x/js/02_dom/04_XDomBoxModel.js @@ -88,11 +88,11 @@ Node.prototype.width = function(){ return 0; }; if( this._state & X.Dom.State.DISPLAY_NONE ) return 0; - if( X.Dom.DOM_W3C ){ + if( X_UA_DOM.W3C ){ // this.css( X.Dom.Style.Unit.px, 'width' ); return this._rawObject.offsetWidth; } else - if( X.Dom.DOM_IE4 ){ + if( X_UA_DOM.IE4 ){ return ( this._rawObject || this._ie4getRawNode() ).offsetWidth; } else { @@ -110,11 +110,11 @@ Node.prototype.height = function(){ return 0; }; if( this._state & X.Dom.State.DISPLAY_NONE ) return 0; - if( X.Dom.DOM_W3C ){ + if( X_UA_DOM.W3C ){ // this.css( X.Dom.Style.Unit.px, 'height' ); return this._rawObject.offsetHeight; } else - if( X.Dom.DOM_IE4 ){ + if( X_UA_DOM.IE4 ){ return ( this._rawObject || this._ie4getRawNode() ).offsetHeight; } else { @@ -132,11 +132,11 @@ Node.prototype.clientWidth = function(){ return 0; }; if( this._state & X.Dom.State.DISPLAY_NONE ) return 0; - if( X.Dom.DOM_W3C ){ + if( X_UA_DOM.W3C ){ // this.css( X.Dom.Style.Unit.px, 'width' ); return this._rawObject.clientWidth; } else - if( X.Dom.DOM_IE4 ){ + if( X_UA_DOM.IE4 ){ return ( this._rawObject || this._ie4getRawNode() ).clientWidth; } else { @@ -154,11 +154,11 @@ Node.prototype.clientHeight = function(){ return 0; }; if( this._state & X.Dom.State.DISPLAY_NONE ) return 0; - if( X.Dom.DOM_W3C ){ + if( X_UA_DOM.W3C ){ // this.css( X.Dom.Style.Unit.px, 'height' ); return this._rawObject.clientHeight; } else - if( X.Dom.DOM_IE4 ){ + if( X_UA_DOM.IE4 ){ return ( this._rawObject || this._ie4getRawNode() ).clientHeight; } else { @@ -176,11 +176,11 @@ Node.prototype.scrollWidth = function(){ return 0; }; if( this._state & X.Dom.State.DISPLAY_NONE ) return 0; - if( X.Dom.DOM_W3C ){ + if( X_UA_DOM.W3C ){ // this.css( X.Dom.Style.Unit.px, 'width' ); return this._rawObject.scrollWidth; } else - if( X.Dom.DOM_IE4 ){ + if( X_UA_DOM.IE4 ){ return ( this._rawObject || this._ie4getRawNode() ).scrollWidth; } else { @@ -198,11 +198,11 @@ Node.prototype.scrollHeight = function(){ return 0; }; if( this._state & X.Dom.State.DISPLAY_NONE ) return 0; - if( X.Dom.DOM_W3C ){ + if( X_UA_DOM.W3C ){ // this.css( X.Dom.Style.Unit.px, 'height' ); return this._rawObject.scrollHeight; } else - if( X.Dom.DOM_IE4 ){ + if( X_UA_DOM.IE4 ){ return ( this._rawObject || this._ie4getRawNode() ).scrollHeight; } else { @@ -220,11 +220,11 @@ Node.prototype.scrollLeft = function(){ return 0; }; if( this._state & X.Dom.State.DISPLAY_NONE ) return 0; - if( X.Dom.DOM_W3C ){ + if( X_UA_DOM.W3C ){ // this.css( X.Dom.Style.Unit.px, 'width' ); return this._rawObject.scrollLeft; } else - if( X.Dom.DOM_IE4 ){ + if( X_UA_DOM.IE4 ){ return ( this._rawObject || this._ie4getRawNode() ).scrollLeft; } else { @@ -242,11 +242,11 @@ Node.prototype.scrollTop = function(){ return 0; }; if( this._state & X.Dom.State.DISPLAY_NONE ) return 0; - if( X.Dom.DOM_W3C ){ + if( X_UA_DOM.W3C ){ // this.css( X.Dom.Style.Unit.px, 'width' ); return this._rawObject.scrollTop; } else - if( X.Dom.DOM_IE4 ){ + if( X_UA_DOM.IE4 ){ return ( this._rawObject || this._ie4getRawNode() ).scrollTop; } else { @@ -272,12 +272,12 @@ Node.prototype.x = function(){ return 0; }; if( this._state & X.Dom.State.DISPLAY_NONE ) return 0; - if( X.Dom.DOM_W3C ){ + if( X_UA_DOM.W3C ){ // this.css( X.Dom.Style.Unit.px, 'left' ); // this.css( X.Dom.Style.Unit.px, 'translateX' ); return this._rawObject.offsetLeft; } else - if( X.Dom.DOM_IE4 ){ + if( X_UA_DOM.IE4 ){ return ( this._rawObject || this._ie4getRawNode() ).offsetLeft; } else { @@ -295,12 +295,12 @@ Node.prototype.y = function(){ return 0; }; if( this._state & X.Dom.State.DISPLAY_NONE ) return 0; - if( X.Dom.DOM_W3C ){ + if( X_UA_DOM.W3C ){ // this.css( X.Dom.Style.Unit.px, 'top' ); // this.css( X.Dom.Style.Unit.px, 'transisitonY' ); return this._rawObject.offsetTop; } else - if( X.Dom.DOM_IE4 ){ + if( X_UA_DOM.IE4 ){ return ( this._rawObject || this._ie4getRawNode() ).offsetTop; } else { @@ -325,10 +325,10 @@ Node.prototype.offset = function( /* xnodeParent */ ){ return { x : 0, y : 0 }; }; - if( X.Dom.DOM_W3C ){ + if( X_UA_DOM.W3C ){ elm = this._rawObject; } else - if( X.Dom.DOM_IE4 ){ + if( X_UA_DOM.IE4 ){ elm = this._rawObject || this._ie4getRawNode(); } else { diff --git a/0.6.x/js/02_dom/05_XDomAttr.js b/0.6.x/js/02_dom/05_XDomAttr.js index 9a43170..6e84b1f 100644 --- a/0.6.x/js/02_dom/05_XDomAttr.js +++ b/0.6.x/js/02_dom/05_XDomAttr.js @@ -134,8 +134,8 @@ X.Dom.Node.prototype.attr = function( nameOrObj /* v */ ){ case 'disabled' : case 'selectedIndex' : if( X.Dom.Attr.HAS_VALUE[ this._tag ] ){ - if( this._newAttrs && X.inObject( nameOrObj, this._newAttrs ) ) return this._newAttrs[ nameOrObj ]; - if( elm = X.Dom.DOM_IE4 ? this._rawObject || this._ie4getRawNode() : this._rawObject ){ + if( this._newAttrs && X_Object_inObject( nameOrObj, this._newAttrs ) ) return this._newAttrs[ nameOrObj ]; + if( elm = X_UA_DOM.IE4 ? this._rawObject || this._ie4getRawNode() : this._rawObject ){ if( !attrs ) attrs = this._attrs = {}; return attrs[ nameOrObj ] = elm[ nameOrObj ]; // getAttribute( nameOrObj )? }; diff --git a/0.6.x/js/02_dom/06_XDomStyle.js b/0.6.x/js/02_dom/06_XDomStyle.js index bae6a2d..f3d8aba 100644 --- a/0.6.x/js/02_dom/06_XDomStyle.js +++ b/0.6.x/js/02_dom/06_XDomStyle.js @@ -1131,7 +1131,7 @@ X.Dom.Node.prototype._getCharSize = }; return 0; }) : - X.Dom.DOM_W3C ? + X_UA_DOM.W3C ? (function(){ var elm, v; Node._body._updateTimerID && Node._body._startUpdate(); @@ -1145,7 +1145,7 @@ X.Dom.Node.prototype._getCharSize = this._rawObject.removeChild( elm ); return this._fontSize = v; }) : - X.Dom.DOM_IE4 ? + X_UA_DOM.IE4 ? (function(){ var font, vu, v, u, _v; Node._body._updateTimerID && Node._body._startUpdate(); diff --git a/0.6.x/js/02_dom/07_XDomNodeList.js b/0.6.x/js/02_dom/07_XDomNodeList.js index 9bf5312..136a3af 100644 --- a/0.6.x/js/02_dom/07_XDomNodeList.js +++ b/0.6.x/js/02_dom/07_XDomNodeList.js @@ -36,7 +36,7 @@ X.Dom.NodeList.prototype.each = function( func /* opt_args... */ ){ i = 0, args; if( 1 < arguments.length ){ - args = X.copyArray( arguments ); + args = X_Object_cloneArray( arguments ); for( ; i < l; ++i ){ args[ 0 ] = i; if( func.apply( this[ i ], args ) === false ) break; diff --git a/0.6.x/js/02_dom/08_XDomSelector.js b/0.6.x/js/02_dom/08_XDomSelector.js index c09136d..0c01534 100644 --- a/0.6.x/js/02_dom/08_XDomSelector.js +++ b/0.6.x/js/02_dom/08_XDomSelector.js @@ -225,7 +225,7 @@ X.Dom.Query._parse = function( query, last ){ scope = this.constructor === X.Dom.NodeList && this.length ? this : [ this.constructor === Node ? this : Node._body ], parents = scope, // 探索元の親要素 XNodeList の場合あり // TODO { title : true,,, } - noLower = 'title id name class for action archive background cite classid codebase data href longdesc profile src usemap',// + X.Dom.DTD.ATTR_VAL_IS_URI.join( ' ' ), + noLower = 'title id name class for action archive background cite classid codebase data href longdesc profile src usemap',// + X_Dom_DTD_ATTR_VAL_IS_URI.join( ' ' ), ARY_PUSH = Array.prototype.push, ret = [], // 結果要素 root = X.Dom.Node.getRoot( scope[ 0 ] ), diff --git a/0.6.x/js/02_dom/09_XDomParser.js b/0.6.x/js/02_dom/09_XDomParser.js index 648de81..db496ef 100644 --- a/0.6.x/js/02_dom/09_XDomParser.js +++ b/0.6.x/js/02_dom/09_XDomParser.js @@ -9,7 +9,7 @@ X_Dom_Parser = { CHARS : { A:1,B:1,C:1,D:1,E:1,F:1,G:1,H:1,I:1,J:1,K:1,L:1,M:1,N:1,O:1,P:1,Q:1,R:1,S:1,T:1,U:1,V:1,W:1,X:1,Y:1,Z:1, a:2,b:2,c:2,d:2,e:2,f:2,g:2,h:2,i:2,j:2,k:2,l:2,m:2,n:2,o:2,p:2,q:2,r:2,s:2,t:2,u:2,v:2,w:2,x:2,y:2,z:2, - '0' : 4, '1' : 4, '2' : 4, '3' : 4, '4' : 4, '5' : 4, '6' : 4, '7' : 4, '8' : 4, '9' : 4, + // "0" : 4, "1" : 4, "2" : 4, "3" : 4, "4" : 4, "5" : 4, "6" : 4, "7" : 4, "8" : 4, "9" : 4, closure compiler で minify すると ie4 で error、eval使う '\t' : 16, '\r\n' : 16, '\r' : 16, '\n' : 16, '\f' : 16, '\b' : 16, ' ' : 16 }, @@ -17,7 +17,7 @@ X_Dom_Parser = { whiteSpace : '\t\r\n\f\b ', // Empty Elements - HTML 4.01 - empty : X.Dom.DTD.EMPTY, + empty : X_Dom_DTD_EMPTY, // Block Elements - HTML 4.01 block : {ADDRESS:1,APPLET:1,BLOCKQUOTE:1,BUTTON:1,CENTER:1,DD:1,DEL:1,DIR:1,DIV:1,DL:1,DT:1,FIELDSET:1,FORM:1,FRAMESET:1,HR:1,IFRAME:1,INS:1, @@ -143,7 +143,7 @@ X_Dom_Parser = { var alphabets = X_Dom_Parser.CHARS, whiteSpace = X_Dom_Parser.CHARS, saveAttr = X_Dom_Parser.saveAttr, - uri = X.Dom.DTD.ATTR_VAL_IS_URI, + uri = X_Dom_DTD_ATTR_VAL_IS_URI, phase = 0, l = html.length, i = 0, diff --git a/0.6.x/js/02_dom/20_XDomImage.js b/0.6.x/js/02_dom/20_XDomImage.js index e5769b8..1ab2830 100644 --- a/0.6.x/js/02_dom/20_XDomImage.js +++ b/0.6.x/js/02_dom/20_XDomImage.js @@ -11,7 +11,7 @@ X.Dom.Image = { var xnode, img, remove, ret, run, memW, memH, w, h; if( X.Type.isString( XnodeOrImageElemOrSrc ) ){ - if( ret = X.Dom.Image._actualSize[ X.Dom.getAbsolutePath( XnodeOrImageElemOrSrc ) ] ) return ret; + if( ret = X.Dom.Image._actualSize[ X_URL_toAbsolutePath( XnodeOrImageElemOrSrc ) ] ) return ret; xnode = X.Dom.Node._systemNode.create( 'img', diff --git a/0.6.x/js/02_dom/22_XDomBuilder.js b/0.6.x/js/02_dom/22_XDomBuilder.js index 9bcb62f..daa50fb 100644 --- a/0.6.x/js/02_dom/22_XDomBuilder.js +++ b/0.6.x/js/02_dom/22_XDomBuilder.js @@ -1,16 +1,16 @@ -X.Dom._useBuilder = true; +X_TEMP.X_Dom_useBuilder = true; -X.Dom._isCleanupTarget = function( elm ){ +X_TEMP._isCleanupTarget = function( elm ){ var cname = ' ' + elm.className + ' ', tag = ( elm.tagName || '' ).toUpperCase(); return cname.indexOf( ' skip-cleanup ' ) === -1 && - ( X.Dom.cleanupTagNames[ tag ] || cname.indexOf( ' cleanup-target ' ) !== -1 ); + ( X_Dom_DTD_CLEANUP_TAGS[ tag ] || cname.indexOf( ' cleanup-target ' ) !== -1 ); }; if( X.UA.MacIE ){ - X.Dom._fixed_remove = function( node, xnode ){ + X_TEMP._fixed_remove = function( node, xnode ){ var parent = node.parentNode, l; node.nodeType !== 3 && alert( node.nodeType + '\n' + ( node.outerHTML || node.data ) ); @@ -88,10 +88,10 @@ if( X.UA.MacIE ){ } else if( X.UA.Opera7 ){ - X.Dom._fixed_remove = function( node ){ + X_TEMP._fixed_remove = function( node ){ if( node.nodeType === 1 || node.nodeType === 3 ){ node.parentNode && node.parentNode.removeChild( node ); - } else { + //} else { //node.data = ''; }; }; @@ -106,7 +106,7 @@ if( X.UA.Opera7 ){ * IE6 には、「空の span エレメントに続く空白は無視される」という謎な癖があります。 */ X.Dom.listenOnce( X.Dom.Event.DOM_PRE_INIT, - X.Dom.DOM_W3C ? + X_UA_DOM.W3C ? (function(){ var r = Node._body, body = r._rawObject, @@ -117,7 +117,7 @@ X.Dom.listenOnce( X.Dom.Event.DOM_PRE_INIT, //X.UA.MacIE && alert( body.innerHTML ); // cleanup tree (function/*cleanUpTree*/( elm, skip, head ){ - var nodes = X.copyArray( elm.childNodes ), + var nodes = X_Object_cloneArray( elm.childNodes ), i = 0, l = nodes.length, node, tag, textNode, content; @@ -126,22 +126,22 @@ X.Dom.listenOnce( X.Dom.Event.DOM_PRE_INIT, switch( node.nodeType ){ case 1 : tag = node.tagName.toUpperCase(); - if( X.Dom.moveToHead[ tag ] ){ + if( X_Dom_DTD_MOVE_TO_HEAD[ tag ] ){ head = head || document.getElementsByTagName( 'head' )[ 0 ]; head.appendChild( node ); continue; } else - if( X.Dom._isCleanupTarget( node ) ){ + if( X_TEMP._isCleanupTarget( node ) ){ elm.removeChild( node ); continue; } else { // pre タグ以下はスペースの置換は行わない - node.childNodes && node.childNodes.length && /*cleanUpTree*/arguments.callee( node, skip || X.Dom.skipCleanupTagNames[ tag ], head ); + node.childNodes && node.childNodes.length && /*cleanUpTree*/arguments.callee( node, skip || X_Dom_DTD_SKIP_CLEANUP_TAGS[ tag ], head ); }; textNode = null; break; case 3 : - content = skip ? node.data : X.Dom.cleanupWhiteSpace( node.data ); + content = skip ? node.data : X_String_cleanupWhiteSpace( node.data ); //console.log( 'Delete space ' + node.data.length + ' => ' + content.length ); if( !textNode && content !== ' ' && content.length ){ node.data = content; @@ -157,7 +157,7 @@ X.Dom.listenOnce( X.Dom.Event.DOM_PRE_INIT, if( !X.UA.Opera7 /*&& !X.UA.MacIE */ ){ elm.removeChild( node ); } else { - X.Dom._fixed_remove( node ); + X_TEMP._fixed_remove( node ); }; //++count; }; @@ -169,7 +169,7 @@ X.Dom.listenOnce( X.Dom.Event.DOM_PRE_INIT, } else { // body の属性値の取得 if( X.UA.IE5678 ){ - html = body.innerHTML.split( X.Dom.CRLF ).join( '' ); // 不要な改行が入る + html = body.innerHTML.split( X_String_CRLF ).join( '' ); // 不要な改行が入る } else { html = body.innerHTML; }; @@ -199,11 +199,11 @@ X.Dom.listenOnce( X.Dom.Event.DOM_PRE_INIT, xnodes.push.apply( xnodes, e.xnodes ); elmProgress.style.width = '100%'; - X.Dom._asyncCreateTree( Node._body, body.childNodes, elmProgress ); + X_TEMP.asyncCreateTree( Node._body, body.childNodes, elmProgress ); } ); }) : -X.Dom.DOM_IE4 ? +X_UA_DOM.IE4 ? (function(){ var r = Node._body, body = r._rawObject, @@ -232,7 +232,7 @@ X.Dom.DOM_IE4 ? xnodes.push.apply( xnodes, e.xnodes ); elmProgress.style.width = '100%'; - X.Dom._asyncCreateTree( Node._body, body.childNodes || body.children, elmProgress ); + X_TEMP.asyncCreateTree( Node._body, body.childNodes || body.children, elmProgress ); } ); }) : @@ -240,8 +240,8 @@ X.Dom.DOM_IE4 ? }) ); -X.Dom._asyncCreateTree = function ( parent, elems, elmProgress, async ){ - var xnodes = async ? 0 : X.copyArray( parent._xnodes ), +X_TEMP.asyncCreateTree = function ( parent, elems, elmProgress, async ){ + var xnodes = async ? 0 : X_Object_cloneArray( parent._xnodes ), l = async ? 0 : xnodes.length, stack = async ? async.stack : [], done = async ? async.done : 0, @@ -251,13 +251,13 @@ X.Dom._asyncCreateTree = function ( parent, elems, elmProgress, async ){ xnodes : xnodes, l : l, i : 0, - elems : X.copyArray( elems ), + elems : X_Object_cloneArray( elems ), j : 0, xtext : null, flag : 0 }, xnode, i, dive; - //alert( 'X.Dom._asyncCreateTree' ); + //alert( 'X_TEMP.asyncCreateTree' ); while( current || ( current = stack.pop() ) ){ i = current.i; l = current.l; @@ -266,7 +266,7 @@ X.Dom._asyncCreateTree = function ( parent, elems, elmProgress, async ){ xnodes = current.xnodes; while( xnode = xnodes[ i ] ){ // - dive = X.Dom._bindElementToXnode( parent, xnode, current ); + dive = X_TEMP.bindElementToXnode( parent, xnode, current ); ++i; ++done; @@ -289,7 +289,7 @@ X.Dom._asyncCreateTree = function ( parent, elems, elmProgress, async ){ async.done = done; }; //alert( 'koko?' ); - X.Timer.once( 0, X.Dom._asyncCreateTree, [ null, null, elmProgress, async || { stack : stack, current : i < l && current, done : done } ] ); + X.Timer.once( 0, X_TEMP.asyncCreateTree, [ null, null, elmProgress, async || { stack : stack, current : i < l && current, done : done } ] ); // progress elmProgress.style.width = ( ( 1 - done / Node._chashe.length ) * 100 | 0 ) + '%'; return; @@ -299,14 +299,15 @@ X.Dom._asyncCreateTree = function ( parent, elems, elmProgress, async ){ current = null; }; // complete - X.Dom.asyncDispatch( 0, { type : X.Dom.Event.DOM_BUILDER_COMPLETE } ); + X.Dom.asyncDispatch( 0, X.Dom.Event.DOM_BUILDER_COMPLETE ); elmProgress.parentNode ? elmProgress.parentNode.removeChild( elmProgress ) : ( elmProgress.outerHTML = '' ); - delete X.Dom._asyncCreateTree; - delete X.Dom._bindElementToXnode; + delete X_TEMP.asyncCreateTree; + delete X_TEMP.bindElementToXnode; + delete X_TEMP.X_Dom_useBuilder; }; -X.Dom._bindElementToXnode = - X.Dom.DOM_W3C ? +X_TEMP.bindElementToXnode = + X_UA_DOM.W3C ? (function( parent, xnode, current ){ var elems = current.elems, //j = current.j, @@ -325,25 +326,25 @@ X.Dom._bindElementToXnode = if( !X.UA.Opera7 && !X.UA.MacIE ){ elm.parentNode.removeChild( elm ); } else { - X.Dom._fixed_remove( elm ); + X_TEMP._fixed_remove( elm ); }; continue; }; if( xnode._xnodeType === 1 ){ if( elm.nodeType === 3 ){ - if( !( text = elm.data ) || ( text = X.Dom.cleanupWhiteSpace( text ) ) === ' ' ){ + if( !( text = elm.data ) || ( text = X_String_cleanupWhiteSpace( text ) ) === ' ' ){ //alert( text.charCodeAt( 0 ) ); if( !X.UA.Opera7 && !X.UA.MacIE ){ elm.parentNode.removeChild( elm ); } else { - X.Dom._fixed_remove( elm ); + X_TEMP._fixed_remove( elm ); }; continue; }; alert( '1:[' +parent._tag + '>' +xnode._tag + '] !== ' + elm.nodeType + '\n' + ( elm.data ) ); } else - if( X.Dom.moveToHead[ tag ] ){ + if( X_Dom_DTD_MOVE_TO_HEAD[ tag ] ){ alert( tag ); continue; } else @@ -364,7 +365,7 @@ X.Dom._bindElementToXnode = xnode.attr( 'value', xnode.html() ).empty(); } else - //if( X.Dom._isCleanupTarget( elm ) ){// !xnode.hasClass( 'skip-cleanup' ) && ( X.Dom.cleanupTagNames[ tag ] || xnode.hasClass( 'cleanup-target' ) ) ){ // ie で body 内の script が2度よばれるのに対処 + //if( X_TEMP._isCleanupTarget( elm ) ){// !xnode.hasClass( 'skip-cleanup' ) && ( X_Dom_DTD_CLEANUP_TAGS[ tag ] || xnode.hasClass( 'cleanup-target' ) ) ){ // ie で body 内の script が2度よばれるのに対処 //alert( '[' +parent._tag + '>' + xnode._tag + '] remove ... ' ); //xnode.destroy(); //} else @@ -375,14 +376,14 @@ X.Dom._bindElementToXnode = return { me : xnode, - xnodes : X.copyArray( xnode._xnodes ), + xnodes : X_Object_cloneArray( xnode._xnodes ), xtext : null, flag : 0, i : 0, l : xnode._xnodes.length, - elems : X.copyArray( elm.childNodes ), + elems : X_Object_cloneArray( elm.childNodes ), j : 0, - skipCleanup : skipCleanup || X.Dom.skipCleanupTagNames[ tag ] + skipCleanup : skipCleanup || X_Dom_DTD_SKIP_CLEANUP_TAGS[ tag ] }; }; // nochild @@ -393,7 +394,7 @@ X.Dom._bindElementToXnode = }; if( elm.nodeType !== 3 ){ - if( !( text = xnode._text ) || ( text = X.Dom.cleanupWhiteSpace( text ) ) === ' ' ){ + if( !( text = xnode._text ) || ( text = X_String_cleanupWhiteSpace( text ) ) === ' ' ){ console.log( '[' +parent._tag + '> UID:' + xnode._uid + ' len:' + xnode._text.length + ' code : ' + xnode._text.charCodeAt( 0 ) + ',' + xnode._text.charCodeAt( 1 ) + '] destroyed.' ); xnode.destroy(); break; @@ -411,7 +412,7 @@ X.Dom._bindElementToXnode = xnode._text = elm.data; // 正確 xnode._root = parent._root; if( !skipCleanup ){ - if( !( text = xnode._text ) || ( text = X.Dom.cleanupWhiteSpace( text ) ) === ' ' ){ + if( !( text = xnode._text ) || ( text = X_String_cleanupWhiteSpace( text ) ) === ' ' ){ console.log( '[' +parent._tag + '>' + xnode._uid + '] destroy ... ' ); xnode.destroy(); }; @@ -444,9 +445,9 @@ X.Dom._bindElementToXnode = xnode.parent = parent; if( xnode._xnodeType === 3 ){ - //alert( X.Dom.cleanupWhiteSpace( xnode._text ) ); + //alert( X_String_cleanupWhiteSpace( xnode._text ) ); if( !skipCleanup ){ - if( !( text = xnode._text ) || ( text = X.Dom.cleanupWhiteSpace( text ) ) === ' ' ){ + if( !( text = xnode._text ) || ( text = X_String_cleanupWhiteSpace( text ) ) === ' ' ){ xnode.destroy(); } else if( xtext ){ @@ -491,8 +492,8 @@ X.Dom._bindElementToXnode = xnode._rawObject = elm; xnode._dirty = 0; xnode._root = parent._root; - //xnode._tag = X.Dom.DTD.TAG_FIX[ tag ] || tag; - if( X.Dom._isCleanupTarget( elm ) ){ //!xnode.hasClass( 'skip-cleanup' ) && ( X.Dom.cleanupTagNames[ tag ] || xnode.hasClass( 'cleanup-target' ) ) ){ + //xnode._tag = X_Dom_DTD_TAG_FIX[ tag ] || tag; + if( X_TEMP._isCleanupTarget( elm ) ){ //!xnode.hasClass( 'skip-cleanup' ) && ( X_Dom_DTD_CLEANUP_TAGS[ tag ] || xnode.hasClass( 'cleanup-target' ) ) ){ xnode.destroy(); break; }; @@ -514,14 +515,14 @@ X.Dom._bindElementToXnode = if( xnode._xnodes && xnode._xnodes.length ){ return { me : xnode, - xnodes : X.copyArray( xnode._xnodes ), + xnodes : X_Object_cloneArray( xnode._xnodes ), xtext : null, flag : 0, i : 0, l : xnode._xnodes.length, - elems : X.copyArray( elm.children ), + elems : X_Object_cloneArray( elm.children ), j : 0, - skipCleanup : skipCleanup || X.Dom.skipCleanupTagNames[ tag ] + skipCleanup : skipCleanup || X_Dom_DTD_SKIP_CLEANUP_TAGS[ tag ] }; }; break; diff --git a/0.6.x/js/03_plugin/00_XPlugin.js b/0.6.x/js/03_plugin/00_XPlugin.js index d7e2032..b13c5a4 100644 --- a/0.6.x/js/03_plugin/00_XPlugin.js +++ b/0.6.x/js/03_plugin/00_XPlugin.js @@ -9,7 +9,7 @@ var X_Pulgin_FLASH_VERSION = !X.UA.IE && navigator.plugins[ 'Shockwave Flash' ] ? parseFloat( navigator.plugins[ 'Shockwave Flash' ].version ) : - X.UA.ActiveX ? (function(){ + !X.UA.IE4 && !X.UA.IE5 && X.UA.ActiveX ? (function(){ var obj = eval( 'var a;try{a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash")}catch(e){}a' ), ver = obj && obj.GetVariable( '$version' ).split( ' ' ).join( '.' ); return parseFloat( ver ) || 0; @@ -40,7 +40,7 @@ var X_Pulgin_FLASH_VERSION = X_Pulgin_UNITY_VERSION = !X.UA.IE && navigator.plugins[ 'Unity Player' ] ? parseFloat( navigator.plugins[ 'Unity Player' ].version ) : - X.UA.ActiveX ? (function(){ + !X.UA.IE4 && !X.UA.IE5 && X.UA.ActiveX ? (function(){ var obj = eval( 'var a;try{a=new ActiveXObject("UnityWebPlayer.UnityWebPlayer.1")}catch(e){}a' ); return obj ? parseFloat( obj.GetPluginVersion() ) : 0; })() : diff --git a/0.6.x/js/05_net/01_XNetXHR.js b/0.6.x/js/05_net/01_XNetXHR.js index f5f4203..5a657f6 100644 --- a/0.6.x/js/05_net/01_XNetXHR.js +++ b/0.6.x/js/05_net/01_XNetXHR.js @@ -19,7 +19,7 @@ new ActiveXObject( 'Msxml2.XMLHTTP.4.0' ); // バージョン4.0 は bugfix が new ActiveXObject( 'Msxml2.XMLHTTP.5.0' ); // バージョン5.0 は bugfix が行われないので、3.0 か 6.0 を指定すべき */ -var X_Net_XHR_W3C = window[ 'XMLHttpRequest' ] && new XMLHttpRequest(), +var X_Net_XHR_W3C = ( !X.UA.IE7 || !X_URL_IS_LOCAL ) && window[ 'XMLHttpRequest' ] && new XMLHttpRequest(), X_Net_XHR_X_DOMAIN = window[ 'XDomainRequest' ] && new XDomainRequest(), X_Net_XHR_VERSION = 0, X_Net_XHR_ACTIVE_X = !X.UA.IE4 && X.UA.IE < 8 && X.UA.ActiveX && ( new Function( [ @@ -50,9 +50,9 @@ X.Net.XHR = { /* * http://hakuhin.jp/as/import.html - * ファイルの読み込みについて + * ファイルの読み込みについて(4 or 5 or 6+) * http://hakuhin.jp/as/javascript.html - * Flash から JavaScript にアクセスする + * Flash から JavaScript にアクセスする(3+) */ FLASH : false, @@ -71,7 +71,7 @@ X.Net.XHR = { }; -if( X.Net.XHR.W3C || X_Net_XHR_ACTIVE_X ){ +if( X_Net_XHR_W3C || X_Net_XHR_ACTIVE_X ){ X_NET_XHRWrapper = X.Class._override( new X.EventDispatcher(), @@ -293,7 +293,11 @@ if( X.Net.XHR.W3C || X_Net_XHR_ACTIVE_X ){ X_NET_XHRWrapper.listen( [ 'readystatechange', 'error', 'abort', 'timeout' ] ); } else if( X.UA.IE7 ){ - X_NET_XHRWrapper.listen( [ 'readystatechange', 'error' ] ); // ie7 ActiveX の場合、error は不可 + if( X_URL_IS_LOCAL ){ + X_NET_XHRWrapper.listen( 'readystatechange' ); // ie7 ActiveX の場合、error は不可 + } else { + X_NET_XHRWrapper.listen( [ 'readystatechange', 'error' ] ); // ie7 ActiveX の場合、error は不可 + }; } else if( X_Net_XHR_ACTIVE_X ){ // win ie5-6 X_NET_XHRWrapper.listen( 'readystatechange' ); diff --git a/0.6.x/js/06_audio/00_XAudio.js b/0.6.x/js/06_audio/00_XAudio.js index 4b94da4..175d2ec 100644 --- a/0.6.x/js/06_audio/00_XAudio.js +++ b/0.6.x/js/06_audio/00_XAudio.js @@ -1,4 +1,5 @@ -X.Audio = { + +X.Audio = { HTML5 : 1, Flash : 2, Silverlight : 3, @@ -8,7 +9,7 @@ QuickTime : 7, create : function( sourceList, opt_option ){ - return new X_AudioProxy( X.Type.isArray( sourceList ) ? X.copyArray( sourceList ) : [ sourceList ], opt_option || {} ); + return new X_AudioProxy( X.Type.isArray( sourceList ) ? X_Object_cloneArray( sourceList ) : [ sourceList ], opt_option || {} ); } }; @@ -134,3 +135,5 @@ function X_AudioProxy_handleEvent( e ){ break; }; }; + + diff --git a/0.6.x/js/06_audio/01_XHTML5Audio.js b/0.6.x/js/06_audio/01_XHTML5Audio.js index 827bed8..6a282dc 100644 --- a/0.6.x/js/06_audio/01_XHTML5Audio.js +++ b/0.6.x/js/06_audio/01_XHTML5Audio.js @@ -1,4 +1,5 @@ -/* + +/* * original : uupaa-js HTML5Audio.js * https://code.google.com/p/uupaa-js/source/browse/trunk/0.8/src/Audio/HTML5Audio.js?r=568 */ @@ -321,6 +322,3 @@ if( window.HTMLAudioElement ){ - - - diff --git a/0.6.x/js/06_audio/02_XSilverlightAudio.js b/0.6.x/js/06_audio/02_XSilverlightAudio.js index 2faf847..2019d4a 100644 --- a/0.6.x/js/06_audio/02_XSilverlightAudio.js +++ b/0.6.x/js/06_audio/02_XSilverlightAudio.js @@ -1,10 +1,14 @@ -/* + +/* * original : uupaa-js SilverlightAudio.js * https://code.google.com/p/uupaa-js/source/browse/trunk/0.8/src/Audio/SilverlightAudio.js?r=568 * * Silverlight 4 → 5における不具合の状況 * http://www.slideshare.net/wakabayashiy/silverlight-4-5 - * + * + * IE10以降でSilverlightでF5押したらフリーズする不具合と対処 + * http://katsuyuzu.hatenablog.jp/entry/2014/01/11/003550 + * * SilverlLight5 ie6&7(ietester,winxp), ie8(winxp) で動作確認。firefox32 では動作しない。(4以下の方がよい?) */ @@ -127,7 +131,7 @@ if( X.Pulgin.SilverlightEnabled ){ */ this.proxy = proxy; this._onload = 'XAudioSilverlightOnLoad';// + ( ++X_Audio_SLAudio_uid ); - this._callback = window[ this._onload ] = X.Callback.create( this, this.onSLReady, [ option.autoplay ] ); + this._callback = window[ this._onload ] = X_Callback_create( this, this.onSLReady, [ option.autoplay ] ); this.xnodeObject = X.Dom.Node._body .create( 'object', { type : 'application/x-silverlight-2', @@ -337,12 +341,12 @@ if( X.Pulgin.SilverlightEnabled ){ // SilverlightAudio.state state : function(){ // @return Hash: { loop, error, paused, ended, source, duration } return { - loop: this._loop, - error: this._error, - paused: this._paused, - ended: this._ended, - source: this._source, - duration: this._duration + loop : this._loop, + error : this._error, + paused : this._paused, + ended : this._ended, + source : this._source, + duration : this._duration }; }, diff --git a/0.6.x/js/20_ui/02_XUI_Attr.js b/0.6.x/js/20_ui/02_XUI_Attr.js index ae31c1e..758438b 100644 --- a/0.6.x/js/20_ui/02_XUI_Attr.js +++ b/0.6.x/js/20_ui/02_XUI_Attr.js @@ -1,5 +1,5 @@ X.UI.Attr = { - AUTO : Number.POSITIVE_INFINITY, + AUTO : 1/0,//Number.POSITIVE_INFINITY, FLOOR : new Function( 'v', 'return 0 <= v ? v | 0 : -( -v | 0 )' ), USER : { @@ -37,7 +37,7 @@ X.UI.Attr = { }, createAttrDef : function( base, defs ){ - var F = base ? X.cloneObject( base ) : {}, + var F = base ? X_Object_clone( base ) : {}, z = base ? base._last : 0, n = 1, p, def; diff --git a/0.6.x/js/20_ui/04_XUI_Event.js b/0.6.x/js/20_ui/04_XUI_Event.js index 7c84e74..05b40d5 100644 --- a/0.6.x/js/20_ui/04_XUI_Event.js +++ b/0.6.x/js/20_ui/04_XUI_Event.js @@ -126,14 +126,14 @@ X.UI.Event = { }; // raw pointing device event -//if( X.Dom.EVENT_POINTER ){ +//if( X_UA_HID.POINTER ){ X.UI.Event.IdToName[ X.UI.Event._POINTER_DOWN ] = 'pointerdown'; X.UI.Event.IdToName[ X.UI.Event._POINTER_UP ] = 'pointerup'; X.UI.Event.IdToName[ X.UI.Event._POINTER_MOVE ] = 'pointermove'; X.UI.Event.IdToName[ X.UI.Event._POINTER_CANCEL ] = 'pointercancel'; /*} else { - if( X.Dom.EVENT_TOUCH ){ + if( X_UA_HID.TOUCH ){ X.UI.Event.IdToName[ X.UI.Event._TOUCH_START ] = 'touchstart'; X.UI.Event.IdToName[ X.UI.Event._TOUCH_END ] = 'touchend'; X.UI.Event.IdToName[ X.UI.Event._TOUCH_MOVE ] = 'touchmove'; diff --git a/0.6.x/js/20_ui/05_XUI_Gesture.js b/0.6.x/js/20_ui/05_XUI_Gesture.js index 77df8c2..9a24b95 100644 --- a/0.6.x/js/20_ui/05_XUI_Gesture.js +++ b/0.6.x/js/20_ui/05_XUI_Gesture.js @@ -266,11 +266,11 @@ Detection.register( Gestures[ name ] ); }; - //if( X.Dom.EVENT_POINTER ){ + //if( X_UA_HID.POINTER ){ Hammer.EVENT_TYPES_START = [ X.UI.Event._POINTER_DOWN ]; types = [ X.UI.Event._POINTER_MOVE, X.UI.Event._POINTER_UP, X.UI.Event._POINTER_CANCEL ]; /*} else - if( X.Dom.EVENT_TOUCH ){ + if( X_UA_HID.TOUCH ){ Hammer.EVENT_TYPES_START = [ X.UI.Event._TOUCH_START, X.UI.Event._MOUSE_DOWN ]; types = [ X.UI.Event._MOUSE_MOVE, X.UI.Event._MOUSE_UP, X.UI.Event._MOUSE_CANCEL, X.UI.Event._TOUCH_MOVE, X.UI.Event._TOUCH_END, X.UI.Event._TOUCH_CANCEL ]; diff --git a/0.6.x/js/20_ui/06_AbstractUINode.js b/0.6.x/js/20_ui/06_AbstractUINode.js index d229636..8ff8402 100644 --- a/0.6.x/js/20_ui/06_AbstractUINode.js +++ b/0.6.x/js/20_ui/06_AbstractUINode.js @@ -778,11 +778,11 @@ X.UI._AbstractUINode = X.EventDispatcher.inherits( }; }; }; - f = X.Callback._classifyCallbackArgs( arg1, arg2, arg3 ); + f = X_Callback_classifyCallbackArgs( arg1, arg2, arg3 ); if( !f.k ){ return X_EventDispatcher_listen.call( this, type, this.User, f ); } else - if( f.k === X.Callback._FUNC_ONLY ){ + if( f.k === X_Callback_FUNC_ONLY ){ return X_EventDispatcher_listen.call( this, type, this.User, f.f, f.s ); }; return X_EventDispatcher_listen.apply( this, arguments ); @@ -815,11 +815,11 @@ X.UI._AbstractUINode = X.EventDispatcher.inherits( }; }; }; - f = X.Callback._classifyCallbackArgs( arg1, arg2, arg3 ); + f = X_Callback_classifyCallbackArgs( arg1, arg2, arg3 ); if( !f.k ){ return X.EventDispatcher.prototype.unlisten.apply( this, [ type, this.User, f ] ); } else - if( f.k === X.Callback._FUNC_ONLY ){ + if( f.k === X_Callback_FUNC_ONLY ){ return X.EventDispatcher.prototype.unlisten.apply( this, [ type, this.User, f.f, f.s ] ); }; return X.EventDispatcher.prototype.unlisten.apply( this, arguments ); diff --git a/0.6.x/js/20_ui/20_PageRoot.js b/0.6.x/js/20_ui/20_PageRoot.js index 37f0a41..d8dbac2 100644 --- a/0.6.x/js/20_ui/20_PageRoot.js +++ b/0.6.x/js/20_ui/20_PageRoot.js @@ -115,7 +115,7 @@ X.UI._PageRoot = X.UI._Box.inherits( // hover や rollover rollout のための move イベントの追加 // X.Dom.Event.activate, X.Dom.Event.deactivate ? // mouseout, mouseover - //if( X.Dom.EVENT_POINTER ){ + //if( X_UA_HID.POINTER ){ this.xnodeInteractiveLayer.listen( X.UI.Event.IdToName[ X.UI.Event._POINTER_MOVE ], X.UI._eventRellay ); if( counter[ X.UI.Event._POINTER_MOVE ] ){ ++counter[ X.UI.Event._POINTER_MOVE ]; diff --git a/0.6.x/js/import.js b/0.6.x/js/import.js index 7c0dcc0..5d820a3 100644 --- a/0.6.x/js/import.js +++ b/0.6.x/js/import.js @@ -3,29 +3,33 @@ document.write( [ 'js/01_core/00_builtin.js', 'js/01_core/01_X.js', 'js/01_core/02_XUA.js', - + 'js/01_core/03_XType.js', - 'js/01_core/04_XCallback.js', - 'js/01_core/05_XClass.js', - 'js/01_core/06_XEvent.js', - 'js/01_core/07_XEventDispatcher.js', - 'js/01_core/08_XTimer.js', + 'js/01_core/04_XObject.js', + 'js/01_core/05_XString.js', + 'js/01_core/06_XURL.js', + + 'js/01_core/10_XCallback.js', + 'js/01_core/11_XClass.js', + 'js/01_core/12_XEvent.js', + 'js/01_core/13_XEventDispatcher.js', + 'js/01_core/14_XTimer.js', - //'js/01_core/09_XSystem.js', - 'js/01_core/10_XLogger.js', - //'js/01_core/11_XView.js', + //'js/01_core/15_XSystem.js', + //'js/01_core/16_XView.js', + 'js/01_core/17_XLogger.js', - 'js/02_dom/10_XDom.js', - 'js/02_dom/11_XDomDTD.js', - 'js/02_dom/12_XDomNode.js', - 'js/02_dom/13_XDomEvent.js', - 'js/02_dom/14_XDomBoxModel.js', - 'js/02_dom/15_XDomAttr.js', - 'js/02_dom/16_XDomStyle.js', - 'js/02_dom/17_XDomNodeList.js', - 'js/02_dom/18_XDomSelector.js', - 'js/02_dom/19_XDomParser.js', + 'js/02_dom/00_XDom.js', + 'js/02_dom/01_XDomDTD.js', + 'js/02_dom/02_XDomNode.js', + 'js/02_dom/03_XDomEvent.js', + 'js/02_dom/04_XDomBoxModel.js', + 'js/02_dom/05_XDomAttr.js', + 'js/02_dom/06_XDomStyle.js', + 'js/02_dom/07_XDomNodeList.js', + 'js/02_dom/08_XDomSelector.js', + 'js/02_dom/09_XDomParser.js', 'js/02_dom/20_XDomImage.js', // remove 'js/02_dom/22_XDomBuilder.js', @@ -38,7 +42,7 @@ document.write( [ 'js/05_net/00_XNet.js', 'js/05_net/01_XNetXHR.js', 'js/05_net/02_XNetJSONP.js', - 'js/05_net/03_XNetForm.js', + //'js/05_net/03_XNetForm.js', 'js/05_net/04_XNetImage.js', 'js/06_audio/00_XAudio.js',