From fea279367eb755020932de6dbc4962c3793d707f Mon Sep 17 00:00:00 2001 From: itozyun Date: Tue, 22 Apr 2014 23:31:31 +0900 Subject: [PATCH] Version 0.6.37, X.Dom.Anime removed. --- 0.6.x/js/core/04_XClass.js | 7 +- 0.6.x/js/dom/10_XDom.js | 22 ++- 0.6.x/js/dom/11_XDomNode.js | 30 ++-- 0.6.x/js/dom/12_XDomEvent.js | 12 +- 0.6.x/js/dom/13_XDomBoxModel.js | 25 ++- 0.6.x/js/dom/15_XDomStyle.js | 8 +- 0.6.x/js/dom/16_XDomAnime.js | 362 ---------------------------------------- 0.6.x/js/dom/18_XDomQuery.js | 6 +- 0.6.x/js/dom/19_XDomParser.js | 5 +- 0.6.x/js/dom/22_XDomBuilder.js | 14 +- 10 files changed, 70 insertions(+), 421 deletions(-) delete mode 100644 0.6.x/js/dom/16_XDomAnime.js diff --git a/0.6.x/js/core/04_XClass.js b/0.6.x/js/core/04_XClass.js index 9fc4fd3..e87daa3 100644 --- a/0.6.x/js/core/04_XClass.js +++ b/0.6.x/js/core/04_XClass.js @@ -74,7 +74,7 @@ X.Class = ( function(){ def = X.Class._getClassDef( klass ); def.Super = Super; def.SuperProto = Super.prototype; - def.SuperConstructor = superDef[ CONSTRUCTOR ]; + def.SuperConstructor = superDef[ CONSTRUCTOR ] || superDef.SuperConstructor; }; return klass; @@ -162,7 +162,10 @@ X.Class = ( function(){ instance.Super = def.SuperProto; instance.SuperConstructor = superConstructor; }; - def[ CONSTRUCTOR ] && def[ CONSTRUCTOR ].apply( instance, args ); + def[ CONSTRUCTOR ] ? + def[ CONSTRUCTOR ].apply( instance, args ) : + def.SuperConstructor && + def.SuperConstructor.apply( instance, args ); return instance; }; diff --git a/0.6.x/js/dom/10_XDom.js b/0.6.x/js/dom/10_XDom.js index fbcfecb..98ae022 100644 --- a/0.6.x/js/dom/10_XDom.js +++ b/0.6.x/js/dom/10_XDom.js @@ -39,7 +39,7 @@ X.Dom = X.Class._override( (function( e ){ !X.Dom._lock && ( X.Dom._lock = true ) && X.Timer.once( 100, X.Dom._detectFinishResizing ); return X.Callback.PREVENT_DEFAULT | X.Callback.STOP_PROPAGATION; - }), + }), _detectFinishResizing : function (){ var size = X.Dom._getSize(); @@ -70,9 +70,9 @@ X.Dom = X.Class._override( h = Node._html = document.documentElement ? new Node( document.documentElement ) : - document.getElementsByTagName ? + X.Dom.DOM_W3C ? new Node( document.getElementsByTagName( 'html' )[ 0 ] ) : - document.all ? + X.Dom.DOM_IE4 ? new Node( document.all.tags( 'html' )[ 0 ] ) : null; @@ -240,7 +240,21 @@ if( !X.UA.IE || 9 <= X.UA.IE ){ }; }; - +if( document.getElementById && ( !X.UA.IEMobile || 5 <= X.UA.IE ) ){ + 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; +}; X.Dom.cleanupTagNames = { noscript : 1, diff --git a/0.6.x/js/dom/11_XDomNode.js b/0.6.x/js/dom/11_XDomNode.js index f544a3c..332a005 100644 --- a/0.6.x/js/dom/11_XDomNode.js +++ b/0.6.x/js/dom/11_XDomNode.js @@ -248,7 +248,7 @@ Node._systemNode = null;// = Node._chashe[ ? ] Node._reserveRemoval = []; -if( !document.getElementById && document.all ){ +if( X.Dom.DOM_IE4 ){ Node.prototype._ie4getRawNode = function(){ var elm = this._rawNode; return elm || @@ -351,10 +351,10 @@ Node.prototype.append = function( v ){ if( v._xnodeType !== 1 && v._xnodeType !== 3 ) return this; // 親の xnodes から v を消す if( v.parent ){ - //if( document.getElementById ){ + //if( X.Dom.DOM_W3C ){ // v.parent._xnodes.splice( v.parent._xnodes.indexOf( v ), 1 ); //} else - //if( document.all ){ + //if( X.Dom.DOM_IE4 ){ v.remove(); //} else { @@ -415,10 +415,10 @@ Node.prototype.appendAt = function( start, v ){ if( v._xnodeType !== 1 && v._xnodeType !== 3 ) return this; // 親の xnodes から v を消す if( v.parent ){ - //if( document.getElementById ){ + //if( X.Dom.DOM_W3C ){ // v.parent._xnodes.splice( v.parent._xnodes.indexOf( v ), 1 ); //} else - //if( document.all ){ + //if( X.Dom.DOM_IE4 ){ v.remove(); //} else { @@ -848,7 +848,7 @@ Node.prototype._startUpdate = function(){ }; Node.prototype._commitUpdate = - document.getElementById ? + X.Dom.DOM_W3C ? ( function( parentElement, nextElement ){ var elm = this._rawNode, xnodes, l, i, frg, next, k, v; @@ -891,7 +891,7 @@ Node.prototype._commitUpdate = }; return elm; }) : - document.all ? + X.Dom.DOM_IE4 ? ( function( parentElement, prevElement ){ var elm = this._rawNode || this._ie4getRawNode(), xnodes, l, i, html, text, prev; @@ -939,7 +939,7 @@ Node.prototype._commitUpdate = (function(){}); Node.prototype._updateRawNode = - document.getElementById ? + X.Dom.DOM_W3C ? ( function( elm ){ var attrs, rename, k, v; @@ -1009,7 +1009,7 @@ Node.prototype._updateRawNode = delete this._dirty; }) : - document.all ? + X.Dom.DOM_IE4 ? ( function( elm ){ var attrs, rename, k, v; @@ -1079,7 +1079,7 @@ Node.prototype._updateRawNode = * document.createElement of ie4 is only for OPTION & IMAGE. */ Node.prototype._actualCreate = - document.getElementById ? (function( isChild ){ + X.Dom.DOM_W3C ? (function( isChild ){ var elm = this._rawNode, xnodes, frg, i, l; @@ -1118,7 +1118,7 @@ Node.prototype._actualCreate = return elm; }) : - document.all ? (function( isChild ){ + X.Dom.DOM_IE4 ? (function( isChild ){ var uid = this._uid, html, xnodes, n, i, l; @@ -1163,7 +1163,7 @@ Node.prototype._actualCreate = (function(){}); Node.prototype._afterActualCreate = - document.getElementById ? (function(){ + X.Dom.DOM_W3C ? (function(){ var elm = this._rawNode, xnodes, l, attrs, k, i; this._root = this.parent._root; @@ -1210,7 +1210,7 @@ Node.prototype._afterActualCreate = this._restoreEvent();// イベントの復帰 }) : - document.all ? (function(){ + X.Dom.DOM_IE4 ? (function(){ var xnodes, i; this._root = this.parent._root; @@ -1231,7 +1231,7 @@ Node.prototype._afterActualCreate = (function(){}); Node.prototype._actualRemove = - document.getElementById ? + X.Dom.DOM_W3C ? ( function( isChild ){ var xnodes = this._xnodes, elm = this._rawNode, @@ -1248,7 +1248,7 @@ Node.prototype._actualRemove = // elm.parentNode.tagName for ie7 !isChild && elm.parentNode && elm.parentNode.tagName && elm.parentNode.removeChild( elm ); }) : - document.all ? + X.Dom.DOM_IE4 ? ( function( isChild ){ var xnodes = this._xnodes, elm = this._rawNode || this._ie4getRawNode(), diff --git a/0.6.x/js/dom/12_XDomEvent.js b/0.6.x/js/dom/12_XDomEvent.js index cda5cd6..c387000 100644 --- a/0.6.x/js/dom/12_XDomEvent.js +++ b/0.6.x/js/dom/12_XDomEvent.js @@ -178,11 +178,11 @@ X.Dom.Node.prototype.listen = function( type, arg1, arg2, arg3 /* [ listener || }; X.Dom.Node.prototype._addEvent = - document.removeEventListener ? + X.Dom.EVENT_W3C ? (function( type ){ this._rawNode && this._rawNode.addEventListener( type, this, false ); }) : - document.detachEvent ? + X.Dom.EVENT_IE ? (function( type ){ if( !this._rawNode ) return; this._handleEvent = this._handleEvent || X.Callback.create( this ); @@ -207,13 +207,13 @@ X.Dom.Node.prototype.unlisten = function( type /* , arg1, arg2, arg3 */ ){ }; X.Dom.Node.prototype._removeEvent = - document.removeEventListener ? + X.Dom.EVENT_W3C ? (function( type ){ var elm = this._rawNode; if( !elm ) return; elm.removeEventListener( type, this, false ); }) : - document.detachEvent ? + X.Dom.EVENT_IE ? (function( type ){ var elm = this._rawNode; if( !elm ) return; @@ -236,7 +236,7 @@ X.Dom.Node.prototype._removeEvent = X.Dom.Node.prototype.handleEvent = - document.removeEventListener ? + X.Dom.EVENT_W3C ? (function( e ){ var ret = X.EventDispatcher.prototype.dispatch.call( this, new X.Dom.Event( e, this ) ); @@ -289,7 +289,7 @@ X.Dom.Node.prototype._restoreEvent = function(){ * Dean Edwards/Matthias Miller/John Resig */ /* for ie9+/Mozilla/Opera9 */ -if( document.addEventListener ){ +if( X.Dom.DOM_W3C ){ X.Dom.Node._document.listenOnce( 'DOMContentLoaded', X.Dom._init ); } else if( 5 <= X.UA.IE && X.inHead ){ diff --git a/0.6.x/js/dom/13_XDomBoxModel.js b/0.6.x/js/dom/13_XDomBoxModel.js index a67c532..ea827c4 100644 --- a/0.6.x/js/dom/13_XDomBoxModel.js +++ b/0.6.x/js/dom/13_XDomBoxModel.js @@ -2,7 +2,6 @@ X.Dom.BoxModel = { CONTENT_BOX : 1, PADDING_BOX : 2, BORDER_BOX : 3, - MARGIN_BOX : 4, defaultBoxModel : 0, boxSizingEnabled : false, @@ -63,11 +62,11 @@ Node.prototype.width = function(){ return 0; }; if( this._state & X.Dom.State.DISPLAY_NONE ) return 0; - if( document.getElementById ){ + if( X.Dom.DOM_W3C ){ // this.css( X.Dom.Style.Unit.px, 'width' ); return this._rawNode.offsetWidth; } else - if( document.all ){ + if( X.Dom.DOM_IE4 ){ return ( this._rawNode || this._ie4getRawNode() ).offsetWidth; } else { @@ -85,11 +84,11 @@ Node.prototype.height = function(){ return 0; }; if( this._state & X.Dom.State.DISPLAY_NONE ) return 0; - if( document.getElementById ){ + if( X.Dom.DOM_W3C ){ // this.css( X.Dom.Style.Unit.px, 'height' ); return this._rawNode.offsetHeight; } else - if( document.all ){ + if( X.Dom.DOM_IE4 ){ return ( this._rawNode || this._ie4getRawNode() ).offsetHeight; } else { @@ -107,11 +106,11 @@ Node.prototype.scrollWidth = function(){ return 0; }; if( this._state & X.Dom.State.DISPLAY_NONE ) return 0; - if( document.getElementById ){ + if( X.Dom.DOM_W3C ){ // this.css( X.Dom.Style.Unit.px, 'width' ); return this._rawNode.scrollWidth; } else - if( document.all ){ + if( X.Dom.DOM_IE4 ){ return ( this._rawNode || this._ie4getRawNode() ).scrollWidth; } else { @@ -129,11 +128,11 @@ Node.prototype.scrollHeight = function(){ return 0; }; if( this._state & X.Dom.State.DISPLAY_NONE ) return 0; - if( document.getElementById ){ + if( X.Dom.DOM_W3C ){ // this.css( X.Dom.Style.Unit.px, 'height' ); return this._rawNode.scrollHeight; } else - if( document.all ){ + if( X.Dom.DOM_IE4 ){ return ( this._rawNode || this._ie4getRawNode() ).scollHeight; } else { @@ -160,12 +159,12 @@ Node.prototype.x = function(){ return 0; }; if( this._state & X.Dom.State.DISPLAY_NONE ) return 0; - if( document.getElementById ){ + if( X.Dom.DOM_W3C ){ // this.css( X.Dom.Style.Unit.px, 'left' ); // this.css( X.Dom.Style.Unit.px, 'translateX' ); return this._rawNode.offsetLeft; } else - if( document.all ){ + if( X.Dom.DOM_IE4 ){ return ( this._rawNode || this._ie4getRawNode() ).offsetLeft; } else { @@ -183,12 +182,12 @@ Node.prototype.y = function(){ return 0; }; if( this._state & X.Dom.State.DISPLAY_NONE ) return 0; - if( document.getElementById ){ + if( X.Dom.DOM_W3C ){ // this.css( X.Dom.Style.Unit.px, 'top' ); // this.css( X.Dom.Style.Unit.px, 'transisitonY' ); return this._rawNode.offsetTop; } else - if( document.all ){ + if( X.Dom.DOM_IE4 ){ return ( this._rawNode || this._ie4getRawNode() ).offsetTop; } else { diff --git a/0.6.x/js/dom/15_XDomStyle.js b/0.6.x/js/dom/15_XDomStyle.js index 019cb67..2d2055d 100644 --- a/0.6.x/js/dom/15_XDomStyle.js +++ b/0.6.x/js/dom/15_XDomStyle.js @@ -71,12 +71,6 @@ X.Dom.Style = { }, /* fontSize -> font-size */ - /* - REG_LARGE : /[A-Z]/g, - uncamelize: function( str ){ - return str.split( ' ' ).join( '' ).replace( X.Dom.Style.REG_LARGE, '-$&' ).toLowerCase(); - }, */ - CHAR_CODE_A : 'A'.charCodeAt( 0 ), _DICTIONARY_UNCAMELIZE : {}, @@ -1128,7 +1122,7 @@ X.Dom.Node.prototype._getCharSize = }; return 0; }) : - document.getElementById ? + X.Dom.DOM_W3C ? (function(){ var elm, v; if( this === Node.root && X.Dom.baseFontSize ) return X.Dom.baseFontSize; diff --git a/0.6.x/js/dom/16_XDomAnime.js b/0.6.x/js/dom/16_XDomAnime.js deleted file mode 100644 index 7ad1ec5..0000000 --- a/0.6.x/js/dom/16_XDomAnime.js +++ /dev/null @@ -1,362 +0,0 @@ -/* - * GPU レイヤーを使うとスムースなアニメーションが得られる - * 但し、古めのデバイスでは処理落ちが起こる - * 処理落ちは、最も古い初代 iPod touch (iOS3) では特に顕著に発生するため、テスト機としてちょうどいい - * css の書き方によっても、処理落ちやガタツキに影響するので、デザイナーが気軽に触れるものではない - * - * transform の登場によって、要素の表示位置を変更する方法が、css-p との2択になった。 - * 初代 iPod touch では、簡単な css-p すら無視してくれるので、積極的に transform を使っていけ、ということだと思う。 - * 但し transform には様々な癖があり、一筋縄ではいかない。 - * - * DHTML を扱う専用モジュールを用意して、そこにコードとノウハウを集積する。 - * - * GPUレイヤーを使用している場合 - * 新しいアニメーション・キューが追加されたときに、現在アニメーションしている要素と親子関係ならば、以前のアニメーションは直ちに停止し、GPUレイヤーを解除。 - */ - -X.Dom.Anime = (function( window, document, navigator, Math, undefined ){ - -var QUEUE_LIST = [], - timerID, - ABS = new Function( 'v', 'return v<0?-v:v' ), - animeEnabled = !X.UA.EInk, - vendor = false, - cssVendor = '', - // X.Dom.listenOnce( X.Dom.Event.DOM_PRE_INIT 以降にアクセス可能 - has3d = X.Dom.Style.has3d, - transform = X.Dom.Style.transform, - transformOrigin = X.Dom.Style.transformOrigin, - translateZ = X.Dom.Style.translateZ, - transition = X.Dom.Style.transition; - -/* - * 新規アニメーション要素が現在アニメーションしている要素と親子関係の場合、 - * 親子関係のアニメーションを停止して一挙に最後の状態へ - */ -function registerQueue( queue ){ - var list = QUEUE_LIST, - l = list.length, - xnode = queue.xnode, - q, _xnode; - for( ; l; ){ - q = list[ --l ]; - _xnode = q.xnode; - _xnode !== xnode && ( _xnode.contains( xnode ) || xnode.contains( _xnode ) ) && q.stop( true ); - }; - list[ list.length ] = queue; - !timerID && ( timerID = X.Timer.nextFrame( onEnterFrame ) ); -}; - -function unregisterQueue( queue ){ - var i = QUEUE_LIST.indexOf( queue ); - if( i === -1 ) return; - if( QUEUE_LIST.length === 1 ){ - QUEUE_LIST.length = 0; - timerID && X.Timer.cancelFrame( onEnterFrame ); - } else { - QUEUE_LIST.splice( i, 1 ); - }; -}; - -function onEnterFrame(){ - var list = QUEUE_LIST, - i = 0, - l = list.length, - t = X.getTime(); - for( ; l; ){ - list[ --l ].tick( t ); - }; - list.length && ( timerID = X.Timer.nextFrame( onEnterFrame ) ); -}; - -var AnimationQueue = function( xnode ){ - this.xnode = xnode; -}; - -X.Class._override( AnimationQueue.prototype, -{ - state : 0, // 0:停止, 1:登録済, 2:アニメ中の親子要素のGPUレイヤー解除待ち, 3:アニメ中;GPUレイヤーにセット、目標値のセット(transisiton有効), 4: - xnode : null, - startTime : 0, - type : 0, - list : null, - init : function( data, duration, timmingFunction ){ - var list, type, prop, data, target, i, l; - if( !( list = this.list ) ) this.list = list = []; - for( type in data ){ - for( i = 0, l = list.length; i < l; ++i ){ - if( list[ i ][ 0 ] === type ){ - prop = list[ i ]; - break; - }; - }; - if( !prop ){ - prop = {}; - switch( type ){ - case 'width' : - prop[ 2 ] = this.xnode.width(); // currentValue - break; - case 'height' : - prop[ 2 ] = this.xnode.height(); // currentValue - break; - case 'x' : - case 'left' : - type = transform ? 'translateX' : 'left'; - prop[ 2 ] = this.xnode.x(); // currentValue - break; - case 'y' : - case 'top' : - type = transform ? 'translateY' : 'top'; - prop[ 2 ] = this.xnode.y(); // currentValue - break; - }; - prop[ 0 ] = type; - }; - prop[ 1 ] = data[ type ]; // target value; - prop[ 3 ] = prop[ 1 ] - prop[ 2 ]; - }; - - this.state === 0 && registerQueue( this ); - - this.state = 1; - this.startTime = X.getTime(); - this.duration = duration; - if( transition ){ - this.timming = 'liner';//timmingFunction; - } else { - this.timming = Liner; - }; - - }, - stop : function( opt_goEndPosition ){ - if( this.xnode.dispatch( { type : X.Dom.Event.ANIME_BEFORE_STOP, target : this.xnode } ) & X.Callback.PREVENT_DEFAULT ){ - return; - }; - opt_goEndPosition && this.tick( this.startTime + this.duration ); - unregisterQueue( this ); - this.xnode.dispatch( { type : X.Dom.Event.ANIME_STOP, target : this.xnode } ); - }, - tick : - transition ? - (function( time ){ - var ratio = ( time - this.startTime ) / this.duration, - list = this.list, - xnode = this.xnode, - css; - if( this.state === 1 ){ - this.state = 2; - calculateCSS( css = {}, list ); - css[ transformOrigin ] = '0 0'; - css[ transition.Property ] = this._transProp; - css[ transition.Delay ] = '0'; - css[ transition.Duration ] = this.duration + 'ms'; - css[ transition.TimingFunction ] = this.timming; - xnode.css( css ); - delete this._transProp; - } else - if( this.state === 2 ){ - this.state = 3; - css = {}; - css[ transform ] = this._transform + translateZ; - xnode.css( css ) - .listenOnce( transition.End, xnode, this.onTransitionEnd ) - .dispatch( { type : X.Dom.Event.ANIME_START, ratio : 1, target : xnode } ); - this.startTime = time; - } else - if( 1 <= ratio ){ - css = {}; - css[ transform ] = this._transform; // GPU support off - delete this._transform; - list.length = 0; - xnode.css( css ) - .unlisten( transition.End, xnode, this.onTransitionEnd ); - } else { - xnode.dispatch( { type : X.Dom.Event.ANIME, ratio : rario, target : xnode } ); - }; - }) : - (function( time ){ - var offset = time - this.startTime, - ratio = offset / this.duration, - list = this.list, - xnode = this.xnode, - css; - if( 1 <= ratio ){ - this.state = 0; - calculateCSS( css = {}, list, 1, offset, this.duration ); - list.length = 0; - xnode.css( css ) - .dispatch( { type : X.Dom.Event.ANIME, ratio : 1, target : xnode } ); - xnode.dispatch( { type : X.Dom.Event.ANIME_END, ratio : 1, target : xnode } ); - } else { - this.state = 3; - calculateCSS( css = {}, list, ratio, offset, this.duration ); - xnode.css( css ) - .dispatch( { type : X.Dom.Event.ANIME, ratio : rario, target : xnode } ); - }; - }), - onTransitionEnd : transition && (function(){ - this.dispatch( { type : X.Dom.Event.ANIME, ratio : 1, target : this.xnode } ); - return this.dispatch( { type : X.Dom.Event.ANIME_END, ratio : 1, target : this.xnode } ); - }), - /* - * transisitonProperty を集める - * trasform を集める - */ - calculateCSS : - transition ? - (function( css, list ){ - var i = 0, - l = list.length, - prop = [], - data, type, transX, transY, _transX, _transY; - for( ; i < l; ++i ){ - data = list[ i ]; - type = data[ 0 ]; - switch( type ){ - case 'translateX' : - transX = data[ 2 ]; - _transX = data[ 1 ]; - break; - case 'translateY' : - transY = data[ 2 ]; - _transY = data[ 1 ]; - break; - default : - css[ type ] = data[ 1 ]; - prop[ prop.length ] = type; - }; - }; - if( transX || transY ){ - prop[ prop.length ] = cssVendor + 'transform'; - if( transX && transY ){ - css[ transform ] = cssVendor + 'translate(' + transX + ',' + transY + ')' + translateZ; - this._transform = cssVendor + 'translate(' + _transX + ',' + _transY + ')'; - - } else - if( transX ){ - css[ transform ] = cssVendor + 'translateX(' + transX + ')' + translateZ; - this._transform = cssVendor + 'translateX(' + _transX + ')'; - } else - if( transY ){ - css[ transform ] = cssVendor + 'translateY(' + transY + ')' + translateZ; - this._transform = cssVendor + 'translateY(' + _transY + ')'; - }; - }; - this._transProp = prop.join( ',' ); - }) : - transform ? - (function( css, list, ratio, time, duration ){ - var i = 0, l = list.length, - easing = this.timming, - data, type, transX, transY; - for( ; i < l; ++i ){ - data = list[ i ]; - type = data[ 0 ]; - switch( type ){ - case 'translateX' : - transX = ratio === 1 ? data[ 1 ] : easing( time, data[ 2 ], data[ 3 ], duration ); - break; - case 'translateY' : - transY = ratio === 1 ? data[ 1 ] : easing( time, data[ 2 ], data[ 3 ], duration ); - break; - default : - css[ type ] = ratio === 1 ? data[ 1 ] : easing( time, data[ 2 ], data[ 3 ], duration ); - }; - }; - if( transX && transY ){ - this._transform = cssVendor + 'translate(' + transX + ',' + transY + ')'; - css[ transform ] = this._transform + translateZ; - } else - if( transX ){ - this._transform = cssVendor + 'translateX(' + transX + ')'; - css[ transform ] = this._transform + translateZ; - } else - if( transY ){ - this._transform = cssVendor + 'translateY(' + transY + ')'; - css[ transform ] = this._transform + translateZ; - }; - }) : - (function( css, list, l, ratio, time, duration ){ - var data, - easing = this.timming; - for( ; l; ){ - data = list[ --l ]; - css[ data[ 0 ] ] = ratio === 1 ? data[ 1 ] : easing( time, data[ 2 ], data[ 3 ], duration ); - }; - }) -}); - -function Liner( t, b, c, d ){ - return c * t / d + b; -}; - -// original : -// https://github.com/arian/cubic-bezier/blob/master/index.js, MIT License -function CubicBezier(x1, y1, x2, y2, t, epsilon){ - var x = t, t0 = 0, t1 = 1, t2 = x, d2, i = 0; - - // First try a few iterations of Newton's method -- normally very fast. - for (; i < 8; i++){ - x2 = CubicBezier.curveX(x1,x2,t2) - x; - if (ABS(x2) < epsilon) return CubicBezier.curveY(y1, y2, t2); - d2 = CubicBezier.derivativeCurveX( x1, x2, t2); - if (ABS(d2) < 1e-6) break; - t2 = t2 - x2 / d2; - }; - if (x < t0) return CubicBezier.curveY(y1, y2, t0); - if (x > t1) return CubicBezier.curveY(y1, y2, t1); - - t2 = x; - - // Fallback to the bisection method for reliability. - while (t0 < t1){ - x2 = CubicBezier.curveX(x1,x2,t2); - if (ABS(x2 - x) < epsilon) return CubicBezier.curveY(y1, y2, t2); - if (x > x2) t0 = t2; - else t1 = t2; - t2 = (t1 - t0) * .5 + t0; - }; - // Failure - return CubicBezier.curveY(y1, y2, t2); - -}; -CubicBezier.curveX = function( x1, x2, t ){ - var v = 1 - t; - return 3 * v * v * t * x1 + 3 * v * t * t * x2 + t * t * t; -}; -CubicBezier.curveY = function( y1, y2, t ){ - var v = 1 - t; - return 3 * v * v * t * y1 + 3 * v * t * t * y2 + t * t * t; -}; -CubicBezier.derivativeCurveX = function( x1, x2, t ){ - var v = 1 - t; - return 3 * (2 * (t - 1) * t + v * v) * x1 + 3 * (- t * t * t + 2 * v * t) * x2; -}; - - - -// export -X.Dom.Node.prototype.anime = function(){ - if( !this._anime ) this._anime = new AnimationQueue( this ); - this._anime.init.apply( this._anime, arguments ); - return this; -}; -X.Dom.Node.prototype.stop = function(){ - if( !this._anime ) return this; - this._anime.stop.apply( this._anime, arguments ); - return this; -}; - -return { - X : 1, - Y : 2, - MOVE : 4, - WIDTH : 8, - HEIGHT : 16, - SIZE : 32, - OPACITY : 64 -}; - -})( window, document, navigator, Math ); - - diff --git a/0.6.x/js/dom/18_XDomQuery.js b/0.6.x/js/dom/18_XDomQuery.js index d8c9533..2e183bc 100644 --- a/0.6.x/js/dom/18_XDomQuery.js +++ b/0.6.x/js/dom/18_XDomQuery.js @@ -225,11 +225,13 @@ X.Dom.Query._parse = function( query, last ){ uid, tmp, xnode, filter, key, op, val, toLower, useName, links, className, attr, flag; + /*@cc_debug[ */ + if( X.Dom.readyState < X.Dom.Event.XDOM_READY ){ alert( 'not ready! X.Dom.listen( X.Dom.Event.XDOM_READY, callback )' ); }; + /*]@cc_debug */ + // 文字列以外は空で返す if( typeof queryString !== 'string' ) return ret; - - xnodes = []; // 以下、パースと探索 diff --git a/0.6.x/js/dom/19_XDomParser.js b/0.6.x/js/dom/19_XDomParser.js index b384393..9d664af 100644 --- a/0.6.x/js/dom/19_XDomParser.js +++ b/0.6.x/js/dom/19_XDomParser.js @@ -22,9 +22,6 @@ X.Dom.Parser = { // (and which close themselves) closeSelf : {colgroup:1,dd:1,dt:1,li:1,options:1,p:1,tbody:1,td:1,tfoot:1,th:1,thead:1,tr:1}, // add tbody - // todo: - plainText : { plaintext : 1, xmp : 1, textarea : 1 }, - sisters : { th : { td : 1 }, td : { th : 1 }, @@ -47,7 +44,7 @@ X.Dom.Parser = { fillAttrs : X.Dom.Attr.noValue, //{checked:1,compact:1,declare:1,defer:1,disabled:1,ismap:1,multiple:1,nohref:1,noresize:1,noshade:1,nowrap:1,readonly:1,selected:1}; // Special Elements (can contain anything) - special : {script:1,style:1,plaintext : 1, xmp : 1, textarea : 1}, + special : { script : 1, style : 1, plaintext : 1, xmp : 1, textarea : 1 }, exec : function( html, handler, async ){ var special = X.Dom.Parser.special, diff --git a/0.6.x/js/dom/22_XDomBuilder.js b/0.6.x/js/dom/22_XDomBuilder.js index ad5e44f..8fb5f9c 100644 --- a/0.6.x/js/dom/22_XDomBuilder.js +++ b/0.6.x/js/dom/22_XDomBuilder.js @@ -6,11 +6,12 @@ X.Dom._useBuilder = true; * 完全にワンページアプリでが空な場合、このコードはビルドに含める必要はない */ X.Dom.listenOnce( X.Dom.Event.DOM_PRE_INIT, - document.getElementById ? + X.Dom.DOM_W3C ? (function(){ var r = Node.root, body = r._rawNode, - i, n = 0; + i, n = 0, + elmProgress; // cleanup tree (function( elm, skip, head ){ @@ -80,7 +81,7 @@ X.Dom.listenOnce( X.Dom.Event.DOM_PRE_INIT, } ); }) : -document.all ? +X.Dom.DOM_IE4 ? (function(){ var r = Node.root, body = r._rawNode, @@ -139,7 +140,7 @@ X.Dom._asyncCreateTree = function ( parent, elems, elmProgress, async ){ xnodes = current.xnodes; while( xnode = xnodes[ i ] ){ // - dive = bindElementToXnode( parent, xnode, current ); + dive = X.Dom._bindElementToXnode( parent, xnode, current ); ++i; ++done; @@ -174,10 +175,11 @@ X.Dom._asyncCreateTree = function ( parent, elems, elmProgress, async ){ X.Dom.asyncDispatch( 0, { type : X.Dom.Event.DOM_BUILDER_COMPLETE } ); elmProgress.parentNode ? elmProgress.parentNode.removeChild( elmProgress ) : ( elmProgress.outerHTML = '' ); delete X.Dom._asyncCreateTree; + delete X.Dom._bindElementToXnode; }; -bindElementToXnode = - document.getElementById ? +X.Dom._bindElementToXnode = + X.Dom.DOM_W3C ? (function( parent, xnode, current ){ var elems = current.elems, //j = current.j, -- 2.11.0