acme.IE = document.documentMode || parseFloat(dua.split('MSIE ')[1]) || parseFloat(dua.split('rv:')[1]) || parseFloat(dav.split('MSIE ')[1]) || 0;\r
acme.IE4 = acme.IE && acme.IE < 5;\r
acme.IE5678 = 5 <= acme.IE && acme.IE < 9;\r
+ acme.IE5 = 5 <= acme.IE && acme.IE < 5.5;\r
+ acme.IE55 = 5.5 <= acme.IE && acme.IE < 6;\r
+ acme.IE6 = 6 <= acme.IE && acme.IE < 7;\r
+ acme.IE7 = 7 <= acme.IE && acme.IE < 8;\r
+ acme.IE8 = 8 <= acme.IE && acme.IE < 9;\r
+ acme.IE9 = 9 <= acme.IE && acme.IE < 10;\r
acme.MacIE = dua.indexOf( 'Mac_PowerPC' ) !== -1 || dua.indexOf( 'Mac_PPC' ) !== -1 || dua.indexOf( 'Mac_68K' ) !== -1;\r
acme.IEMobile = dua.toLowerCase().indexOf( 'iemobile' ) !== -1 || n.platform === 'WinCE';\r
acme.WinPhone = dua.toLowerCase().indexOf( 'windows phone' ) !== -1;\r
console.log( '>> IE : ' + acme.IE + ' ActiveX : ' + acme.ActiveX );\r
- // TODO XBox360, XBox1\r
+ // TODO XBox360, XBox1, Modern or Desktop, Standalone\r
return acme;\r
};\r
\r
\r
if( X.UA.IE < 7 ){ // error @ NN7.2\r
// bonus: hotfix for IE6 SP1 (bug KB823727)\r
+ // multipleIEs IE6 standalone 版では不可\r
document.execCommand && document.execCommand( 'BackgroundImageCache', false, true );\r
};\r
\r
window.msCancelRequestAnimationFrame ||\r
false;\r
\r
+/*\r
+ * \r
+ * http://please-sleep.cou929.nu/script-yielding-with-setimmediate.html\r
+ * setImmediate での script yielding\r
+ * \r
+ * http://ie.microsoft.com/testdrive/Performance/setImmediateSorting/Default.html\r
+ * setImmediate API\r
+ * \r
+ * if( timer < 4ms ) useSetImmediate\r
+ * \r
+ * if (window.msSetImmediate)\r
+ {\r
+ this.timer = msSetImmediate(function () { t.stepper(); }); \r
+ }\r
+ else if (window.MozSetImmediate)\r
+ {\r
+ this.timer = MozSetImmediate(function () { t.stepper(); }); \r
+ }\r
+ else if (window.WebkitSetImmediate) {\r
+ this.timer = WebkitSetImmediate(function () { t.stepper(); });\r
+ }\r
+ else if (window.OSetImmediate)\r
+ {\r
+ this.timer = OSetImmediate(function () { t.stepper(); }); \r
+ }\r
+ */\r
+\r
X.Timer = {\r
INTERVAL_TIME : 16,\r
TICKET_LIST : [],\r
};\r
X.Timer.timerId = 0;\r
X.Timer.busy = false;\r
- X.Timer._update(); \r
+ X.Timer._update();\r
},\r
_update : function(){\r
var list = X.Timer.TICKET_LIST,\r
i = list.length,\r
- n = Infinity,\r
- l;\r
+ n;\r
if( i === 0 ){\r
X.Timer.timerId && window.clearTimeout( X.Timer.timerId );\r
X.Timer.timerId = 0;\r
return;\r
};\r
- for( ; i; ){\r
- ( l = list[ --i ].last ) < n && ( n = l );\r
- };\r
+ \r
+ 1 < i && list.sort( x_timer_compareQueue );\r
+ \r
+ n = list[ i - 1 ].last;\r
+ \r
if( n < X.Timer.next || X.Timer.timerId === 0 ){\r
X.Timer.timerId && window.clearTimeout( X.Timer.timerId );\r
X.Timer.timerId = window.setTimeout( X.Timer._loop, X.Timer.INTERVAL_TIME * n );\r
\r
};\r
\r
+// 大きい -> 小さい\r
+function x_timer_compareQueue( a, b ){\r
+ return a.last < b.last ? 1 : a.last === b.last ? 0 : -1;\r
+};\r
+\r
+\r
// http://havelog.ayumusato.com/develop/javascript/e528-ios6_scrolling_timer_notcall.html\r
// iOS6 スクロール中のタイマー発火絡みのバグ備忘\r
if( X.UA.iOS ){\r
* @private\r
* @type {Object}\r
*/\r
- _rawNode : null,\r
+ _rawObject : null,\r
_handleEvent : null,\r
\r
_dispatching : 0, // dispatch 中の unlisten で使用\r
*/\r
Constructor : function( rawObject ){\r
if( rawObject ){\r
- this._rawNode = rawObject;\r
+ this._rawObject = rawObject;\r
};\r
},\r
\r
};\r
\r
\r
-x_eventdispatcher_actualAddEvent =\r
+var x_eventdispatcher_actualAddEvent =\r
// Days on the Moon DOM Events とブラウザの実装 \r
// http://nanto.asablo.jp/blog/2007/03/23/1339502\r
// Safari 2 では関数オブジェクトしか EventListener として使えませんが、Safari のナイトリービルドでは handleEvent メソッドを持つオブジェクトも EventListener として使えるようです。\r
x_eventdispatcher_temp.EVENT_W3C && ( X.UA.WebKit < 525.13 || X.UA.Opera7 || X.UA.NetFront < 4 ) ? // Safari3-\r
(function( that, type ){\r
- var raw = that._rawNode;\r
- if( !raw ) return;\r
- that._handleEvent = that._handleEvent || X.Callback.create( that );\r
- type = X.Dom.Event.Rename[ type ] || type;\r
+ var raw = that._rawObject;\r
+ if( !raw ) return; \r
+ that._handleEvent = that._handleEvent || X.Callback.create( that, x_eventdispatcher_actualHandleEvent );\r
+ type = X.Dom.Event.Rename[ type] || type;\r
if( raw.addEventListener ){\r
raw.addEventListener( type, that._handleEvent, false );\r
} else {\r
}) :\r
x_eventdispatcher_temp.EVENT_W3C ?\r
(function( that, type ){\r
- that._rawNode && that._rawNode.addEventListener( X.Dom.Event.Rename[ type ] || type, that, false );\r
+ if( that._rawObject ){\r
+ that._handleEvent = that._handleEvent || X.Callback.create( that, x_eventdispatcher_actualHandleEvent );\r
+ that._rawObject.addEventListener( X.Dom.Event.Rename[ type ] || type, that._handleEvent, false );\r
+ };\r
}) :\r
x_eventdispatcher_temp.EVENT_IE ?\r
(function( that, type ){\r
- var raw = that._rawNode;\r
+ var raw = that._rawObject;\r
if( !raw ) return;\r
type = X.Dom.Event.Rename[ type ] || type;\r
//if( type === 'load' && that._tag && X.Dom.Event._LOAD_FIX_TAGS[ that._tag ] ){\r
// type = 'readystatechange';\r
//};\r
- that._handleEvent = that._handleEvent || X.Callback.create( that );\r
- if( raw.attachEvent ){\r
- raw.attachEvent( 'on' + type, that._handleEvent );\r
+ if( that._isXHR ){\r
+ // ie8- の XHR は window.event が更新されないため, eventType 毎に callback を指定する\r
+ raw[ 'on' + type ] = X.Callback.create( that, X.EventDispatcher.prototype.dispatch, [ type ] );\r
} else {\r
- raw[ 'on' + type ] = that._handleEvent;\r
+ that._handleEvent = that._handleEvent || X.Callback.create( that, x_eventdispatcher_actualHandleEvent );\r
+ \r
+ if( raw.attachEvent ){\r
+ raw.attachEvent( 'on' + type, that._handleEvent );\r
+ } else {\r
+ raw[ 'on' + type ] = that._handleEvent;\r
+ }; \r
};\r
+\r
}) :\r
(function( that, type ){\r
- var raw = that._rawNode || ( that._ie4getRawNode && that._ie4getRawNode() );\r
+ var raw = that._rawObject || ( that._ie4getRawNode && that._ie4getRawNode() );\r
if( !raw ) return;\r
- raw[ 'on' + ( X.Dom.Event.Rename[ type ] || type ) ] = that._handleEvent = that._handleEvent || X.Callback.create( that );\r
+ raw[ 'on' + ( X.Dom.Event.Rename[ type ] || type ) ] = that._handleEvent = that._handleEvent || X.Callback.create( that, x_eventdispatcher_actualHandleEvent );\r
});\r
\r
\r
-x_eventdispatcher_actualRemoveEvent =\r
+var x_eventdispatcher_actualRemoveEvent =\r
x_eventdispatcher_temp.EVENT_W3C && ( X.UA.WebKit < 525.13 || X.UA.Opera7 || X.UA.NetFront < 4 ) ? // Safari3-\r
(function( that, type ){\r
- var raw = that._rawNode;\r
+ var raw = that._rawObject;\r
if( !raw ) return;\r
type = X.Dom.Event.Rename[ type ] || type;\r
\r
}) :\r
x_eventdispatcher_temp.EVENT_W3C ?\r
(function( that, type ){\r
- var raw = that._rawNode;\r
+ var raw = that._rawObject;\r
if( !raw ) return;\r
- raw.removeEventListener( X.Dom.Event.Rename[ type ] || type, that, false );\r
+ raw.removeEventListener( X.Dom.Event.Rename[ type ] || type, that._handleEvent, false );\r
+ if( !that._listeners ){\r
+ X.Callback._correct( that._handleEvent );\r
+ delete that._handleEvent;\r
+ };\r
}) :\r
x_eventdispatcher_temp.EVENT_IE ?\r
(function( that, type ){\r
- var raw = that._rawNode;\r
+ var raw = that._rawObject;\r
if( !raw ) return;\r
type = X.Dom.Event.Rename[ type ] || type;\r
//if( type === 'load' && that._tag && X.Dom.Event._LOAD_FIX_TAGS[ that._tag ] ){\r
// type = 'readystatechange';\r
//};\r
- if( raw.attachEvent ){\r
- raw.detachEvent( 'on' + type, that._handleEvent );\r
- } else {\r
+ if( that._isXHR ){\r
+ X.Callback._correct( raw[ 'on' + type ] );\r
raw[ 'on' + type ] = X.emptyFunction;\r
raw[ 'on' + type ] = '';\r
- };\r
- if( !that._listeners ){\r
- X.Callback._correct( that._handleEvent );\r
- delete that._handleEvent;\r
+ } else {\r
+ if( raw.attachEvent ){\r
+ raw.detachEvent( 'on' + type, that._handleEvent );\r
+ } else {\r
+ raw[ 'on' + type ] = X.emptyFunction;\r
+ raw[ 'on' + type ] = '';\r
+ };\r
+ \r
+ if( !that._listeners ){\r
+ X.Callback._correct( that._handleEvent );\r
+ delete that._handleEvent;\r
+ }; \r
};\r
}) :\r
(function( that, type ){\r
- var raw = that._rawNode || ( that._ie4getRawNode && that._ie4getRawNode() );\r
+ var raw = that._rawObject || ( that._ie4getRawNode && that._ie4getRawNode() );\r
if( !raw ) return;\r
type = X.Dom.Event.Rename[ type ] || type;\r
raw[ 'on' + type ] = X.emptyFunction;\r
});\r
\r
\r
+// handleEvent を拡張可能にするために、クロージャに移動した\r
+// Is this in regard to the Safari 1.x preventDefault bug on click/dblclick?\r
+// https://groups.google.com/forum/#!msg/comp.lang.javascript/uYEuCHjHxnw/yKoHtZJPa1QJ\r
+var x_eventdispatcher_actualHandleEvent =\r
+ X.UA.IE4 || X.UA.IE5678 ? // ie45678 EVENT_IE & EVENT_DOM0 for ie4\r
+ (function(){\r
+ var ret;\r
+ \r
+ if( event.type === 'readystatechange' && this._tag && X.Dom.Event._LOAD_FIX_TAGS[ this._tag ] ){\r
+ //type = 'readystatechange';\r
+ };\r
+ \r
+ ret = X.EventDispatcher.prototype.dispatch.call( this, new X.Dom.Event( event, this, this._rawObject ) );\r
+\r
+ if( ret & X.Callback.STOP_PROPAGATION ){\r
+ event.cancelBubble = true;\r
+ };\r
+ if( ret & X.Callback.PREVENT_DEFAULT ){\r
+ this._tag === 'A' && this._rawObject.blur();\r
+ return event.returnValue = false;\r
+ };\r
+ }) :\r
+ //X.Dom.EVENT_W3C & EVENT_DOM0\r
+ (function( e ){\r
+ var ret = X.EventDispatcher.prototype.dispatch.call( this, new X.Dom.Event( e, this ) );\r
+ \r
+ if( ret & X.Callback.STOP_PROPAGATION ){\r
+ e.stopPropagation();\r
+ };\r
+ if( ret & X.Callback.PREVENT_DEFAULT ){\r
+ this._tag === 'A' && this._rawObject.blur();\r
+ e.preventDefault();\r
+ if( X.UA.WebKit < 525.13 ){ // Safari3-\r
+ if( e.type === 'click' || e.type === 'dbclick' ){\r
+ X.Dom._safariPreventDefault = true;\r
+ };\r
+ };\r
+ return false;\r
+ };\r
+ });\r
+\r
+\r
+// イベントの退避、dom が画面から抜かれる場合に実施しておく\r
+X.EventDispatcher.prototype._migrateEvent = function(){\r
+ var hash = this._listeners,\r
+ type;\r
+ if( !hash ) return;\r
+ for( type in hash ){\r
+ // 数字イベントの除外\r
+ '' + parseFloat( type ) !== type && x_eventdispatcher_actualRemoveEvent( this, type );\r
+ };\r
+};\r
+\r
+// 退避したイベントの復帰\r
+X.EventDispatcher.prototype._restoreEvent = function(){\r
+ var hash = this._listeners,\r
+ type;\r
+ if( !hash ) return;\r
+ for( type in hash ){\r
+ // 数字イベントの除外\r
+ '' + parseFloat( type ) !== type && x_eventdispatcher_actualAddEvent( this, type );\r
+ };\r
+};\r
+\r
+\r
console.log( 'X.Core.EventDispatcher' );\r
};\r
};\r
\r
- size = Node._fontSizeNode._rawNode.offsetHeight;\r
+ size = Node._fontSizeNode._rawObject.offsetHeight;\r
if( X.Dom.baseFontSize !== size ){\r
X.Dom.baseFontSize && X.Dom.asyncDispatch( 0, { type : X.Dom.Event.BASE_FONT_RESIZED, fontSize : size, w : X.Dom.w, h : X.Dom.h } );\r
X.Dom.baseFontSize = size;\r
X.Timer.add( 333, X.Dom._resize );\r
};\r
\r
- X.Dom.baseFontSize = Node._fontSizeNode._rawNode.offsetHeight;\r
+ X.Dom.baseFontSize = Node._fontSizeNode._rawObject.offsetHeight;\r
\r
X.Dom.readyState = X.Dom.Event.XDOM_READY;\r
X.Dom.asyncDispatch( 0, { type : X.Dom.Event.XDOM_READY, w : X.Dom.w = size[ 0 ], h : X.Dom.h = size[ 1 ] } );\r
getBaseFontSize : function(){\r
if( Node._body._updateTimerID ){\r
Node._body._startUpdate();\r
- return Node._fontSizeNode._rawNode.offsetHeight;\r
+ return Node._fontSizeNode._rawObject.offsetHeight;\r
};\r
return X.Dom.baseFontSize;\r
}\r
\r
if( !( X.UA.IE < 9 || X.UA.iOS ) ){\r
X.Dom._detectFontSize = function(){\r
- var size = Node._fontSizeNode._rawNode.offsetHeight;\r
+ var size = Node._fontSizeNode._rawObject.offsetHeight;\r
if( X.Dom.baseFontSize !== size ){\r
X.Dom.baseFontSize && X.Dom.asyncDispatch( 0, { type : X.Dom.Event.BASE_FONT_RESIZED, fontSize : size, w : X.Dom.w, h : X.Dom.h } );\r
X.Dom.baseFontSize = size;\r
\r
_isNew : false,\r
\r
- _rawNode : null,\r
+ _rawObject : null,\r
_rect : null, // \r
\r
_root : null, // xnode が文書ツリーに属しているか?はこれを見る\r
this._xnodeType = 1;\r
this._state = X.Dom.State.DISPLAY_INLINE; // todo\r
arguments[ 1 ] && this.attr( arguments[ 1 ] );\r
- css = arguments[ 2 ] || arguments[ 1 ];\r
+ css = arguments[ 2 ];\r
css && this[ X.Type.isString( css ) ? 'cssText' : 'css' ]( css );\r
} else\r
if( Node._newByText ){\r
// v.parentNode || v.parentElement : dom1 || dom0\r
this.parent = ( parent = v.parentNode || v.parentElement ) && parent.tagName /* ie7- */ && Node._getXNode( parent );\r
this._root = this.parent ? this.parent._root : null;\r
- this._rawNode = v;\r
+ this._rawObject = v;\r
this._xnodeType = 1;\r
this._state = X.Dom.State.DISPLAY_BLOCK; // todo\r
this._tag = v.tagName.toUpperCase();\r
if( xnode = Node._getXNode( v ) ) return xnode;\r
this.parent = Node._getXNode( v.parentNode );\r
this._root = this.parent ? this.parent._root : null;\r
- this._rawNode = v;\r
+ this._rawObject = v;\r
this._xnodeType = 3;\r
this._state = X.Dom.State.DISPLAY_INLINE;\r
this._text = v.data;\r
return Node.none;\r
case Node.IS_IMAGE :\r
if( xnode = Node._getXNode( v ) ) return xnode;\r
- this._rawNode = v;\r
+ this._rawObject = v;\r
this._xnodeType = 4;\r
v.UID = uid;\r
this._state = X.Dom.State.EXIST;\r
case Node.IS_WINDOW :\r
case Node.IS_DOCUMENT :\r
if( xnode = Node._getXNode( v ) ) return xnode;\r
- this._rawNode = v;\r
+ this._rawObject = v;\r
this._xnodeType = 2;\r
this._state = X.Dom.State.DISPLAY_BLOCK;\r
break;\r
case Node.IS_RAW_TEXT :\r
if( v.UID ) return Node._chashe[ v.UID ];\r
for( chashe = Node._chashe, i = chashe.length; i; ){\r
- if( ( xnode = Node._chashe[ --i ] ) && ( xnode._rawNode === v ) ) return xnode;\r
+ if( ( xnode = Node._chashe[ --i ] ) && ( xnode._rawObject === v ) ) return xnode;\r
};\r
};\r
};\r
\r
Node.getRoot = function( xnode ){\r
return Node._document;\r
- //return xNode._body._rawNode.documentElement ? node : node.ownerDocument || node.document;\r
+ //return xNode._body._rawObject.documentElement ? node : node.ownerDocument || node.document;\r
};\r
// XMLかどうかを判別する\r
Node.isXmlDocument =\r
X.emptyFunction :\r
(function( root ){\r
if( X.Type.isBoolean( root.isXML ) ) return root.isXML;\r
- return root.isXML = root._rawNode.createElement( 'p' ).tagName !== root._rawNode.createElement( 'P' ).tagName;\r
+ return root.isXML = root._rawObject.createElement( 'p' ).tagName !== root._rawObject.createElement( 'P' ).tagName;\r
});\r
\r
Node._chashe = [];\r
\r
if( X.Dom.DOM_IE4 ){\r
Node.prototype._ie4getRawNode = function(){\r
- var elm = this._rawNode;\r
+ var elm = this._rawObject;\r
return elm ||\r
- ( ( elm = document.all[ 'ie4uid' + this._uid ] ) && ( this._rawNode = elm ) ) ||\r
- ( this._id && ( elm = document.all[ this._id ] ) ) && ( this._rawNode = elm );\r
+ ( ( elm = document.all[ 'ie4uid' + this._uid ] ) && ( this._rawObject = elm ) ) ||\r
+ ( this._id && ( elm = document.all[ this._id ] ) ) && ( this._rawObject = elm );\r
};\r
};\r
\r
\r
if( !this._state ) return;\r
\r
- elm = this._rawNode || this._ie4getRawNode && this._ie4getRawNode();\r
+ elm = this._rawObject || this._ie4getRawNode && this._ie4getRawNode();\r
\r
if( xnodes && ( i = xnodes.length ) ){\r
//for( ; i; ){\r
var elm, type, xnodes, i;\r
if( !v || this._xnodeType !== 1 ) return false;\r
// contains ie4+\r
- if( ( elm = this._rawNode || this._ie4getRawNode && this._ie4getRawNode() ) && document.contains && ( type = Node._getType( v ) ) && ( type === Node.IS_RAW_HTML || type === Node.IS_RAW_TEXT ) ){\r
+ if( ( elm = this._rawObject || this._ie4getRawNode && this._ie4getRawNode() ) && document.contains && ( type = Node._getType( v ) ) && ( type === Node.IS_RAW_HTML || type === Node.IS_RAW_TEXT ) ){\r
return elm.contains( v ); \r
};\r
//if( document.compareDocumentPosition ){\r
* HTML要素に対して name の関数を実行しその戻り値を返す。関数に渡す引数も任意に設定できる。\r
*/\r
Node.prototype.call = function( name /*, opt_args... */ ){\r
- var raw = this._rawNode || this._ie4getRawNode && this._ie4getRawNode(),\r
+ var raw = this._rawObject || this._ie4getRawNode && this._ie4getRawNode(),\r
l = arguments.length - 1,\r
func, args, params, i;\r
if( !raw ) return;\r
* Async commit update\r
* \r
* state:\r
- * 0 : no_rawnode\r
+ * 0 : no_rawObject\r
* 1 : no_parent\r
* 2 : no_root\r
* 3 : dirty\r
\r
removal = Node._reserveRemoval;\r
\r
- tmp = this._rawNode.style.visibility;\r
- //this._rawNode.style.visibility = 'hidden';\r
+ tmp = this._rawObject.style.visibility;\r
+ //this._rawObject.style.visibility = 'hidden';\r
\r
//console.log( '_actualRemove().' );\r
\r
//console.log( 'end of _startUpdate().' );\r
\r
X.Dom._listeners && X.Dom._listeners[ X.Dom.Event.AFTER_UPDATE ] && X.Dom.asyncDispatch( 0, { type : X.Dom.Event.AFTER_UPDATE } );\r
- //this._rawNode.style.visibility = tmp;\r
+ //this._rawObject.style.visibility = tmp;\r
};\r
\r
Node.prototype._commitUpdate =\r
X.Dom.DOM_W3C ?\r
( function( parentElement, nextElement ){\r
- var elm = this._rawNode,\r
+ var elm = this._rawObject,\r
xnodes, l, i, frg, next, k, v;\r
\r
if( this._state & X.Dom.State.IE5_DISPLAY_NONE_FIX ){\r
parentElement.appendChild( this._actualCreate() );\r
this._afterActualCreate();\r
\r
- return elm || this._rawNode;\r
+ return elm || this._rawObject;\r
} else\r
if( ( xnodes = this._xnodes ) && ( l = xnodes.length ) ) {\r
\r
}) :\r
X.Dom.DOM_IE4 ? \r
( function( parentElement, prevElement ){\r
- var elm = this._rawNode || this._ie4getRawNode(),\r
+ var elm = this._rawObject || this._ie4getRawNode(),\r
xnodes, l, i, html, text, prev;\r
\r
if( !elm ){\r
prevElement.insertAdjacentHTML( 'AfterEnd', this._actualCreate() ) :\r
parentElement.insertAdjacentHTML( 'AfterBegin', this._actualCreate() );\r
this._afterActualCreate();\r
- return this._rawNode || this._ie4getRawNode();\r
+ return this._rawObject || this._ie4getRawNode();\r
};\r
\r
xnodes = this._xnodes;\r
continue;\r
};\r
};\r
- k = \r
+\r
( v = attrs[ k ] ) === undefined ?\r
elm.removeAttribute( rename[ k ] || k ) :\r
+ X.UA.IE === 8 ?\r
+ elm.setAttribute( rename[ k ] || k, X.Dom.Attr.noValue[ k ] ? k : v ) :\r
( elm[ rename[ k ] || k ] = X.Dom.Attr.noValue[ k ] ? k : v ); \r
\r
};\r
};\r
\r
if( this._dirty & X.Dom.Dirty.IE_FILTER ){\r
- this._rawNode.style.filter = X.Dom.Style.SPECIAL_FIX( this._css );\r
+ this._rawObject.style.filter = X.Dom.Style.SPECIAL_FIX( this._css );\r
};\r
\r
// attr\r
*/\r
Node.prototype._actualCreate =\r
X.Dom.DOM_W3C ? (function( isChild ){\r
- var elm = this._rawNode,\r
+ var elm = this._rawObject,\r
xnodes, frg, i, l;\r
\r
if( this._xnodeType === 3 ){\r
if( elm ) return elm;\r
delete this._dirty;\r
- return this._rawNode = document.createTextNode( X.Dom.chrReferanceTo( this._text ) );\r
+ return this._rawObject = document.createTextNode( X.Dom.chrReferanceTo( this._text ) );\r
};\r
\r
if( !elm ){\r
delete this._cssText;\r
};\r
this._isNew = true;\r
- this._rawNode = elm =\r
+ this._rawObject = elm =\r
X.Dom._strictElmCreation ?\r
document.createElement( [\r
'<', this._tag,\r
\r
if( this._xnodeType === 3 ){\r
html = [ '<FONT id=ie4uid', uid, ' UID="', uid, '">', this._text, '</FONT>' ];// fake textNode\r
- delete this._rawNode;\r
+ delete this._rawObject;\r
} else {\r
- if( this._rawNode && !isChild ) this._actualRemove( true );\r
+ if( this._rawObject && !isChild ) this._actualRemove( true );\r
\r
if( this._dirty & X.Dom.Dirty.CSS && !( this._cssText = X.Dom.Style.objToCssText( this._css ) ) ){\r
delete this._cssText;\r
\r
Node.prototype._afterActualCreate =\r
X.Dom.DOM_W3C ? (function(){\r
- var elm = this._rawNode, xnodes, l, attrs, k, i;\r
+ var elm = this._rawObject, xnodes, l, attrs, k, i;\r
\r
this._root = this.parent._root;\r
\r
X.Dom.DOM_W3C ?\r
( function( isChild ){\r
var xnodes = this._xnodes,\r
- elm = this._rawNode,\r
+ elm = this._rawObject,\r
child, i, l;\r
if( xnodes && ( l = xnodes.length ) ){\r
for( i = 0; i < l; ++i ){\r
X.Dom.DOM_IE4 ?\r
( function( isChild ){\r
var xnodes = this._xnodes,\r
- elm = this._rawNode || this._ie4getRawNode(),\r
+ elm = this._rawObject || this._ie4getRawNode(),\r
i, l, xnode;\r
if( xnodes && ( l = xnodes.length ) ){\r
for( i = 0; i < l; ++i ){\r
elm.removeAttribute( 'id' ); // ?\r
document.all[ this._id || ( 'ie4uid' + this._uid ) ] = null; // MacIE5 でエラー\r
if( !isChild ) elm.outerHTML = '';\r
- delete this._rawNode;\r
+ delete this._rawObject;\r
}) :\r
(function(){});\r
\r
window.PointerEvent = window.MSPointerEvent;\r
};\r
} else {\r
- X.Dom.Event = function( e, xnode, element ){\r
+ X.Dom.Event = function( e, xnode, element, opt_type ){\r
var btn;\r
\r
//this._event = e;\r
- this.type = X.Dom.Event.RenameTo[ e.type ] || e.type;\r
+ this.type = X.Dom.Event.RenameTo[ e.type ] || e.type || opt_type;\r
this.target = Node._getXNode( e.srcElement ); // xnode\r
if( this.target && this.target._xnodeType === 3 ) this.target = this.target.parent; // ie4 の fake Textnode がヒットしていないか?\r
this.currentTarget = xnode; // xnode\r
})( X.Dom.Event.Rename, X.Dom.Event.RenameTo );\r
\r
\r
-\r
-// TODO handleEvent を拡張可能にするために、クロージャに移動する\r
-// Is this in regard to the Safari 1.x preventDefault bug on click/dblclick?\r
-// https://groups.google.com/forum/#!msg/comp.lang.javascript/uYEuCHjHxnw/yKoHtZJPa1QJ\r
-X.Dom.Node.prototype.handleEvent =\r
- X.UA.IE4 || X.UA.IE5678 ? // ie45678 EVENT_IE & EVENT_DOM0 for ie4\r
- (function(){\r
- var ret;\r
- \r
- if( event.type === 'readystatechange' && this._tag && X.Dom.Event._LOAD_FIX_TAGS[ this._tag ] ){\r
- //type = 'readystatechange';\r
- };\r
- \r
- ret = X.EventDispatcher.prototype.dispatch.call( this, new X.Dom.Event( event, this, this._rawNode ) );\r
-\r
- if( ret & X.Callback.STOP_PROPAGATION ){\r
- event.cancelBubble = true;\r
- };\r
- if( ret & X.Callback.PREVENT_DEFAULT ){\r
- this._tag === 'A' && this._rawNode.blur();\r
- return event.returnValue = false;\r
- };\r
- }) :\r
- //X.Dom.EVENT_W3C & EVENT_DOM0\r
- (function( e ){\r
- var ret = X.EventDispatcher.prototype.dispatch.call( this, new X.Dom.Event( e, this ) );\r
- \r
- if( ret & X.Callback.STOP_PROPAGATION ){\r
- e.stopPropagation();\r
- };\r
- if( ret & X.Callback.PREVENT_DEFAULT ){\r
- this._tag === 'A' && this._rawNode.blur();\r
- e.preventDefault();\r
- if( X.UA.WebKit < 525.13 ){ // Safari3-\r
- if( e.type === 'click' || e.type === 'dbclick' ){\r
- X.Dom._safariPreventDefault = true;\r
- };\r
- };\r
- return false;\r
- };\r
- });\r
-\r
-\r
-// イベントの退避、dom が画面から抜かれる場合に実施しておく\r
-X.Dom.Node.prototype._migrateEvent = function(){\r
- var hash = this._listeners,\r
- type;\r
- if( !hash ) return;\r
- for( type in hash ){\r
- // 数字イベントの除外\r
- /*'' + parseFloat( type ) !== type && */x_eventdispatcher_actualRemoveEvent( this, type );\r
- };\r
-};\r
-\r
-// 退避したイベントの復帰\r
-X.Dom.Node.prototype._restoreEvent = function(){\r
- var hash = this._listeners,\r
- type;\r
- if( !hash ) return;\r
- for( type in hash ){\r
- // 数字イベントの除外\r
- /*'' + parseFloat( type ) !== type && */ x_eventdispatcher_actualAddEvent( this, type );\r
- };\r
-};\r
-\r
/* -----------------------------------------------\r
* Document Ready\r
* Dean Edwards/Matthias Miller/John Resig\r
if( this._state & X.Dom.State.DISPLAY_NONE ) return 0;\r
if( X.Dom.DOM_W3C ){\r
// this.css( X.Dom.Style.Unit.px, 'width' );\r
- return this._rawNode.offsetWidth;\r
+ return this._rawObject.offsetWidth;\r
} else\r
if( X.Dom.DOM_IE4 ){\r
- return ( this._rawNode || this._ie4getRawNode() ).offsetWidth;\r
+ return ( this._rawObject || this._ie4getRawNode() ).offsetWidth;\r
} else {\r
\r
};\r
if( this._state & X.Dom.State.DISPLAY_NONE ) return 0;\r
if( X.Dom.DOM_W3C ){\r
// this.css( X.Dom.Style.Unit.px, 'height' );\r
- return this._rawNode.offsetHeight;\r
+ return this._rawObject.offsetHeight;\r
} else\r
if( X.Dom.DOM_IE4 ){\r
- return ( this._rawNode || this._ie4getRawNode() ).offsetHeight;\r
+ return ( this._rawObject || this._ie4getRawNode() ).offsetHeight;\r
} else {\r
\r
};\r
if( this._state & X.Dom.State.DISPLAY_NONE ) return 0;\r
if( X.Dom.DOM_W3C ){\r
// this.css( X.Dom.Style.Unit.px, 'width' );\r
- return this._rawNode.clientWidth;\r
+ return this._rawObject.clientWidth;\r
} else\r
if( X.Dom.DOM_IE4 ){\r
- return ( this._rawNode || this._ie4getRawNode() ).clientWidth;\r
+ return ( this._rawObject || this._ie4getRawNode() ).clientWidth;\r
} else {\r
\r
};\r
if( this._state & X.Dom.State.DISPLAY_NONE ) return 0;\r
if( X.Dom.DOM_W3C ){\r
// this.css( X.Dom.Style.Unit.px, 'height' );\r
- return this._rawNode.clientHeight;\r
+ return this._rawObject.clientHeight;\r
} else\r
if( X.Dom.DOM_IE4 ){\r
- return ( this._rawNode || this._ie4getRawNode() ).clientHeight;\r
+ return ( this._rawObject || this._ie4getRawNode() ).clientHeight;\r
} else {\r
\r
};\r
if( this._state & X.Dom.State.DISPLAY_NONE ) return 0;\r
if( X.Dom.DOM_W3C ){\r
// this.css( X.Dom.Style.Unit.px, 'width' );\r
- return this._rawNode.scrollWidth;\r
+ return this._rawObject.scrollWidth;\r
} else\r
if( X.Dom.DOM_IE4 ){\r
- return ( this._rawNode || this._ie4getRawNode() ).scrollWidth;\r
+ return ( this._rawObject || this._ie4getRawNode() ).scrollWidth;\r
} else {\r
\r
};\r
if( this._state & X.Dom.State.DISPLAY_NONE ) return 0;\r
if( X.Dom.DOM_W3C ){\r
// this.css( X.Dom.Style.Unit.px, 'height' );\r
- return this._rawNode.scrollHeight;\r
+ return this._rawObject.scrollHeight;\r
} else\r
if( X.Dom.DOM_IE4 ){\r
- return ( this._rawNode || this._ie4getRawNode() ).scrollHeight;\r
+ return ( this._rawObject || this._ie4getRawNode() ).scrollHeight;\r
} else {\r
\r
};\r
if( this._state & X.Dom.State.DISPLAY_NONE ) return 0;\r
if( X.Dom.DOM_W3C ){\r
// this.css( X.Dom.Style.Unit.px, 'width' );\r
- return this._rawNode.scrollLeft;\r
+ return this._rawObject.scrollLeft;\r
} else\r
if( X.Dom.DOM_IE4 ){\r
- return ( this._rawNode || this._ie4getRawNode() ).scrollLeft;\r
+ return ( this._rawObject || this._ie4getRawNode() ).scrollLeft;\r
} else {\r
\r
};\r
if( this._state & X.Dom.State.DISPLAY_NONE ) return 0;\r
if( X.Dom.DOM_W3C ){\r
// this.css( X.Dom.Style.Unit.px, 'width' );\r
- return this._rawNode.scrollTop;\r
+ return this._rawObject.scrollTop;\r
} else\r
if( X.Dom.DOM_IE4 ){\r
- return ( this._rawNode || this._ie4getRawNode() ).scrollTop;\r
+ return ( this._rawObject || this._ie4getRawNode() ).scrollTop;\r
} else {\r
\r
};\r
if( X.Dom.DOM_W3C ){\r
// this.css( X.Dom.Style.Unit.px, 'left' );\r
// this.css( X.Dom.Style.Unit.px, 'translateX' );\r
- return this._rawNode.offsetLeft;\r
+ return this._rawObject.offsetLeft;\r
} else\r
if( X.Dom.DOM_IE4 ){\r
- return ( this._rawNode || this._ie4getRawNode() ).offsetLeft;\r
+ return ( this._rawObject || this._ie4getRawNode() ).offsetLeft;\r
} else {\r
\r
};\r
if( X.Dom.DOM_W3C ){\r
// this.css( X.Dom.Style.Unit.px, 'top' );\r
// this.css( X.Dom.Style.Unit.px, 'transisitonY' );\r
- return this._rawNode.offsetTop;\r
+ return this._rawObject.offsetTop;\r
} else\r
if( X.Dom.DOM_IE4 ){\r
- return ( this._rawNode || this._ie4getRawNode() ).offsetTop; \r
+ return ( this._rawObject || this._ie4getRawNode() ).offsetTop; \r
} else {\r
\r
};\r
};\r
\r
if( X.Dom.DOM_W3C ){\r
- elm = this._rawNode;\r
+ elm = this._rawObject;\r
} else\r
if( X.Dom.DOM_IE4 ){\r
- elm = this._rawNode || this._ie4getRawNode(); \r
+ elm = this._rawObject || this._ie4getRawNode(); \r
} else {\r
\r
};\r
case 'selectedIndex' :\r
if( X.Dom.Attr.HAS_VALUE[ this._tag ] ){\r
if( this._newAttrs && X.inObject( nameOrObj, this._newAttrs ) ) return this._newAttrs[ nameOrObj ];\r
- if( elm = X.Dom.DOM_IE4 ? this._rawNode || this._ie4getRawNode() : this._rawNode ){\r
+ if( elm = X.Dom.DOM_IE4 ? this._rawObject || this._ie4getRawNode() : this._rawObject ){\r
attrs[ nameOrObj ] = elm[ nameOrObj ]; // getAttribute( nameOrObj )?\r
};\r
return attrs[ nameOrObj ];\r
delete this._css;
this._state &= ~X.Dom.State.IE5_DISPLAY_NONE_FIX;
obj = {};
- v = v.split( ';' );
+ v = v.split( ';' ); // TODO content ";" などにも対応
for( i = 0, l = v.length; i < l; ++i ){
attr = v[ i ].split( ':' );
( name = attr[ 0 ] ) && ( obj[ name ] = attr[ 1 ] || true );
Node._body._updateTimerID && Node._body._startUpdate();
if( this === Node._body && X.Dom.baseFontSize ) return X.Dom.baseFontSize;
if( this._fontSize ) return this._fontSize;
- return this._fontSize = parseFloat( getComputedStyle( this._rawNode, null ).fontSize );
+ return this._fontSize = parseFloat( getComputedStyle( this._rawObject, null ).fontSize );
}) :
document.defaultView && document.defaultView.getComputedStyle ?
(function(){
Node._body._updateTimerID && Node._body._startUpdate();
if( this === Node._body && X.Dom.baseFontSize ) return X.Dom.baseFontSize;
if( this._fontSize ) return this._fontSize;
- return this._fontSize = parseFloat( document.defaultView.getComputedStyle( this._rawNode, null ).fontSize );
+ return this._fontSize = parseFloat( document.defaultView.getComputedStyle( this._rawObject, null ).fontSize );
}) :
X.UA.IE && 5.5 <= X.UA.IE ?
(function(){
if( this === Node._body && X.Dom.baseFontSize ) return X.Dom.baseFontSize;
if( this._fontSize ) return this._fontSize;
- font = this._rawNode.currentStyle.fontSize;
+ font = this._rawObject.currentStyle.fontSize;
//font = this._css && this._css.fontSize || '1em';
vu = X.Dom.Style._splitValueAndUnit( font );
v = vu[ 0 ];
if( this === Node._body && X.Dom.baseFontSize ) return X.Dom.baseFontSize;
if( this._fontSize ) return this._fontSize;
- this._rawNode.appendChild( elm = document.createElement( 'span' ) );
+ this._rawObject.appendChild( elm = document.createElement( 'span' ) );
elm.style.cssText = 'display:block;position:absolute;top:0;left:0;visivility:hidden;line-height:1;height:1em;';
elm.innerHTML = 'X';
v = elm.offsetHeight;
- this._rawNode.removeChild( elm );
+ this._rawObject.removeChild( elm );
return this._fontSize = v;
}) :
X.Dom.DOM_IE4 ?
Node._body._updateTimerID && Node._body._startUpdate();
if( this._fontSize ) return this._fontSize;
- elm = this._rawNode || this._ie4getRawNode();
+ elm = this._rawObject || this._ie4getRawNode();
elm.insertAdjacentHTML( 'BeforeEnd', '<span style="visivility:hidden;line-height:1;">X</span>' );
elm = elm.children[ elm.children.length - 1 ];
v = elm.offsetHeight;
}\r
);\r
Node._body._startUpdate();\r
- img = xnode._ie4getRawNode ? xnode._ie4getRawNode() : xnode._rawNode;\r
+ img = xnode._ie4getRawNode ? xnode._ie4getRawNode() : xnode._rawObject;\r
remove = true;\r
} else {\r
if( XnodeOrImageElemOrSrc.constructor === X.Dom.Node ){\r
xnode = XnodeOrImageElemOrSrc;\r
- img = xnode._ie4getRawNode ? xnode._ie4getRawNode() : xnode._rawNode;\r
+ img = xnode._ie4getRawNode ? xnode._ie4getRawNode() : xnode._rawObject;\r
} else\r
if( X.Type.isHTMLElement( XnodeOrImageElemOrSrc ) ){\r
img = XnodeOrImageElemOrSrc;\r
// if( timer ) return; // これがあると safari3.2 で駄目、、、\r
this.finish = true;\r
this.timerID && X.Timer.remove( this.timerID );\r
- if( window.opera && !this.xnode._rawNode.complete ){\r
+ if( window.opera && !this.xnode._rawObject.complete ){\r
this.timerID = this.asyncDispatch( 0, { type : X.Event.ERROR } );\r
return;\r
};\r
}, \r
_detect : function(){\r
if( this.finish === true ) return;\r
- if( this.xnode._rawNode && this.xnode._rawNode.complete ){\r
+ if( this.xnode._rawObject && this.xnode._rawObject.complete ){\r
this.finish = true;\r
- if( this.xnode._rawNode.width ) return;\r
+ if( this.xnode._rawObject.width ) return;\r
this.timerID = this.asyncDispatch( 0, { type : X.Event.ERROR } );\r
return;\r
};\r
parent.parentNode.insertBefore( clone, parent );\r
parent.style.display = 'none';\r
if( xnode ){\r
- xnode.parent.parent._rawNode = clone;\r
+ xnode.parent.parent._rawObject = clone;\r
};\r
} else {\r
// ignore\r
X.Dom.DOM_W3C ?\r
(function(){\r
var r = Node._body,\r
- body = r._rawNode,\r
+ body = r._rawObject,\r
copy, i, l, node, html,\r
elmProgress;\r
// TODO\r
X.Dom.DOM_IE4 ?\r
(function(){\r
var r = Node._body,\r
- body = r._rawNode,\r
+ body = r._rawObject,\r
elmProgress = '_xdom_builder_progress',\r
html;\r
\r
if( xnode._tag !== tag ){\r
alert( '2:[' +parent._tag + '>' +xnode._tag + ' len:' + (xnode._xnodes ? xnode._xnodes.length : '' ) + '] !== ' + tag + ' ' + (elm.childNodes ? elm.childNodes.length : '' ) + '\n' + elm.outerHTML );\r
} else {\r
- xnode._rawNode = elm;\r
+ xnode._rawObject = elm;\r
//if( ( doc = elm.ownerDocument || elm.document ) && ( doc.createElement( 'p' ).tagName === doc.createElement( 'P' ).tagName ) ){\r
if( tag.charAt( 0 ) === '/' ) tag = tag.slice( 1 );\r
xnode._tag = tag;\r
//};\r
xnode._root = parent._root;\r
elm.UID = xnode._uid;\r
+ current.xtext = null;\r
\r
if( tag === 'TEXTAREA' ){\r
xnode.attr( 'value', xnode.html() ).empty();\r
- current.xtext = null;\r
+ \r
} else\r
- if( X.Dom._isCleanupTarget( elm ) ){// !xnode.hasClass( 'skip-cleanup' ) && ( X.Dom.cleanupTagNames[ tag ] || xnode.hasClass( 'cleanup-target' ) ) ){ // ie で body 内の script が2度よばれるのに対処\r
+ //if( X.Dom._isCleanupTarget( elm ) ){// !xnode.hasClass( 'skip-cleanup' ) && ( X.Dom.cleanupTagNames[ tag ] || xnode.hasClass( 'cleanup-target' ) ) ){ // ie で body 内の script が2度よばれるのに対処\r
//alert( '[' +parent._tag + '>' + xnode._tag + '] remove ... ' );\r
- xnode.destroy();\r
- } else\r
+ //xnode.destroy();\r
+ //} else\r
if( elm.childNodes && elm.childNodes.length ){\r
//alert( '[' +parent._tag + '>' + xnode._tag + ' ' + (xnode._xnodes ? xnode._xnodes.length : '' ) + '] === ' + tag + ' ' + (elm.childNodes ? elm.childNodes.length : '' ) + ' Hit\n' + elm.outerHTML );\r
- current.xtext = null;\r
+ //current.xtext = null;\r
++current.j;\r
\r
return {\r
skipCleanup : skipCleanup || X.Dom.skipCleanupTagNames[ tag ]\r
};\r
};\r
+ // nochild\r
+ //current.xtext = null;\r
};\r
++current.j;\r
break;\r
};\r
\r
++current.j;\r
- xnode._rawNode = elm;\r
+ xnode._rawObject = elm;\r
xnode._text = elm.data; // 正確\r
xnode._root = parent._root;\r
if( !skipCleanup ){\r
} else {\r
++current.j;\r
\r
- xnode._rawNode = elm;\r
+ xnode._rawObject = elm;\r
xnode._root = parent._root;\r
//xnode._tag = X.Dom.DTD.TAG_FIX[ tag ] || tag;\r
if( X.Dom._isCleanupTarget( elm ) ){ //!xnode.hasClass( 'skip-cleanup' ) && ( X.Dom.cleanupTagNames[ tag ] || xnode.hasClass( 'cleanup-target' ) ) ){\r
};\r
};\r
// for\r
- if( !xnode._rawNode ){\r
+ if( !xnode._rawObject ){\r
alert( xnode._tag + ' ' + xnode._id + ' !== none...' );\r
};\r
\r