* getBoundingClientRect\r
*/\r
Node.prototype.width = function(){\r
- if( !this.parent ){// todo : _state で tree に所属しているか?判定\r
- console.log( 'xnode.width() : no parent' );\r
- return 0;\r
- };\r
+ if( ( this._flags & X_Node_State.IN_TREE ) === 0 || this._flags & X_Node_State.STYLE_IS_DISPLAY_NONE ) return 0;\r
+ \r
X_Node_updateTimerID && X_Node_startUpdate();\r
- if( !this._root ){\r
- console.log( 'xnode.width() : not belong tree.' );\r
- return 0;\r
- };\r
- if( this._state & X_Node_State.DISPLAY_NONE ) return 0;\r
+ \r
if( X_UA_DOM.W3C ){\r
- // this.css( X_Node_CSS_Unit.px, 'width' );\r
- return this._rawObject.offsetWidth;\r
+ // TODO width : length + overflow : hidden ならそれを返す? <- block or inline\r
+ return this._rawObject ? this._rawObject.offsetWidth : 0;\r
} else\r
if( X_UA_DOM.IE4 ){\r
return ( this._rawObject || X_Node__ie4getRawNode( this ) ).offsetWidth;\r
};\r
\r
Node.prototype.height = function(){\r
- if( !this.parent ){\r
- console.log( 'xnode.height() : no parent' );\r
- return 0;\r
- };\r
+ if( ( this._flags & X_Node_State.IN_TREE ) === 0 || this._flags & X_Node_State.STYLE_IS_DISPLAY_NONE ) return 0;\r
+ \r
X_Node_updateTimerID && X_Node_startUpdate();\r
- if( !this._root ){\r
- console.log( 'xnode.height() : not belong tree.' );\r
- return 0;\r
- };\r
- if( this._state & X_Node_State.DISPLAY_NONE ) return 0;\r
+ \r
if( X_UA_DOM.W3C ){\r
// this.css( X_Node_CSS_Unit.px, 'height' );\r
- return this._rawObject.offsetHeight;\r
+ return this._rawObject ? this._rawObject.offsetHeight : 0;\r
} else\r
if( X_UA_DOM.IE4 ){\r
return ( this._rawObject || X_Node__ie4getRawNode( this ) ).offsetHeight;\r
};\r
\r
Node.prototype.clientWidth = function(){\r
- if( !this.parent ){// todo : _state で tree に所属しているか?判定\r
- console.log( 'xnode.width() : no parent' );\r
- return 0;\r
- };\r
+ if( ( this._flags & X_Node_State.IN_TREE ) === 0 || this._flags & X_Node_State.STYLE_IS_DISPLAY_NONE ) return 0;\r
+ \r
X_Node_updateTimerID && X_Node_startUpdate();\r
- if( !this._root ){\r
- console.log( 'xnode.width() : not belong tree.' );\r
- return 0;\r
- };\r
- if( this._state & X_Node_State.DISPLAY_NONE ) return 0;\r
+ \r
if( X_UA_DOM.W3C ){\r
// this.css( X_Node_CSS_Unit.px, 'width' );\r
- return this._rawObject.clientWidth;\r
+ return this._rawObject ? this._rawObject.clientWidth : 0;\r
} else\r
if( X_UA_DOM.IE4 ){\r
return ( this._rawObject || X_Node__ie4getRawNode( this ) ).clientWidth;\r
};\r
\r
Node.prototype.clientHeight = function(){\r
- if( !this.parent ){\r
- console.log( 'xnode.height() : no parent' );\r
- return 0;\r
- };\r
+ if( ( this._flags & X_Node_State.IN_TREE ) === 0 || this._flags & X_Node_State.STYLE_IS_DISPLAY_NONE ) return 0;\r
+ \r
X_Node_updateTimerID && X_Node_startUpdate();\r
- if( !this._root ){\r
- console.log( 'xnode.height() : not belong tree.' );\r
- return 0;\r
- };\r
- if( this._state & X_Node_State.DISPLAY_NONE ) return 0;\r
+\r
if( X_UA_DOM.W3C ){\r
// this.css( X_Node_CSS_Unit.px, 'height' );\r
- return this._rawObject.clientHeight;\r
+ return this._rawObject ? this._rawObject.clientHeight : 0;\r
} else\r
if( X_UA_DOM.IE4 ){\r
return ( this._rawObject || X_Node__ie4getRawNode( this ) ).clientHeight;\r
};\r
\r
Node.prototype.scrollWidth = function(){\r
- if( !this.parent ){// todo : _state で tree に所属しているか?判定\r
- console.log( 'xnode.width() : no parent' );\r
- return 0;\r
- };\r
+ if( ( this._flags & X_Node_State.IN_TREE ) === 0 || this._flags & X_Node_State.STYLE_IS_DISPLAY_NONE ) return 0;\r
+ \r
X_Node_updateTimerID && X_Node_startUpdate();\r
- if( !this._root ){\r
- console.log( 'xnode.width() : not belong tree.' );\r
- return 0;\r
- };\r
- if( this._state & X_Node_State.DISPLAY_NONE ) return 0;\r
+\r
if( X_UA_DOM.W3C ){\r
// this.css( X_Node_CSS_Unit.px, 'width' );\r
- return this._rawObject.scrollWidth;\r
+ return this._rawObject ? this._rawObject.scrollWidth : 0;\r
} else\r
if( X_UA_DOM.IE4 ){\r
return ( this._rawObject || X_Node__ie4getRawNode( this ) ).scrollWidth;\r
};\r
\r
Node.prototype.scrollHeight = function(){\r
- if( !this.parent ){\r
- console.log( 'xnode.height() : no parent' );\r
- return 0;\r
- };\r
+ if( ( this._flags & X_Node_State.IN_TREE ) === 0 || this._flags & X_Node_State.STYLE_IS_DISPLAY_NONE ) return 0;\r
+ \r
X_Node_updateTimerID && X_Node_startUpdate();\r
- if( !this._root ){\r
- console.log( 'xnode.height() : not belong tree.' );\r
- return 0;\r
- };\r
- if( this._state & X_Node_State.DISPLAY_NONE ) return 0;\r
+\r
if( X_UA_DOM.W3C ){\r
- // this.css( X_Node_CSS_Unit.px, 'height' );\r
- return this._rawObject.scrollHeight;\r
+ return this._rawObject ? this._rawObject.scrollHeight : 0;\r
} else\r
if( X_UA_DOM.IE4 ){\r
return ( this._rawObject || X_Node__ie4getRawNode( this ) ).scrollHeight;\r
};\r
\r
Node.prototype.scrollLeft = function(){\r
- if( !this.parent ){// todo : _state で tree に所属しているか?判定\r
- console.log( 'xnode.scrollLeft() : no parent' );\r
- return 0;\r
- };\r
+ if( ( this._flags & X_Node_State.IN_TREE ) === 0 || this._flags & X_Node_State.STYLE_IS_DISPLAY_NONE ) return 0;\r
+ \r
X_Node_updateTimerID && X_Node_startUpdate();\r
- if( !this._root ){\r
- console.log( 'xnode.scrollLeft() : not belong tree.' );\r
- return 0;\r
- };\r
- if( this._state & X_Node_State.DISPLAY_NONE ) return 0;\r
+\r
if( X_UA_DOM.W3C ){\r
// this.css( X_Node_CSS_Unit.px, 'width' );\r
- return this._rawObject.scrollLeft;\r
+ return this._rawObject ? this._rawObject.scrollLeft : 0;\r
} else\r
if( X_UA_DOM.IE4 ){\r
return ( this._rawObject || X_Node__ie4getRawNode( this ) ).scrollLeft;\r
};\r
\r
Node.prototype.scrollTop = function(){\r
- if( !this.parent ){// todo : _state で tree に所属しているか?判定\r
- console.log( 'xnode.scrollTop() : no parent' );\r
- return 0;\r
- };\r
+ if( ( this._flags & X_Node_State.IN_TREE ) === 0 || this._flags & X_Node_State.STYLE_IS_DISPLAY_NONE ) return 0;\r
+ \r
X_Node_updateTimerID && X_Node_startUpdate();\r
- if( !this._root ){\r
- console.log( 'xnode.scrollTop() : not belong tree.' );\r
- return 0;\r
- };\r
- if( this._state & X_Node_State.DISPLAY_NONE ) return 0;\r
+ \r
if( X_UA_DOM.W3C ){\r
// this.css( X_Node_CSS_Unit.px, 'width' );\r
- return this._rawObject.scrollTop;\r
+ return this._rawObject ? this._rawObject.scrollTop : 0;\r
} else\r
if( X_UA_DOM.IE4 ){\r
return ( this._rawObject || X_Node__ie4getRawNode( this ) ).scrollTop;\r
*/\r
// X_Node_CSS_transform,\r
Node.prototype.x = function(){\r
- if( !this.parent ){\r
- console.log( 'xnode.x() : no parent' );\r
- return 0;\r
- };\r
+ if( ( this._flags & X_Node_State.IN_TREE ) === 0 || this._flags & X_Node_State.STYLE_IS_DISPLAY_NONE ) return 0;\r
+ \r
X_Node_updateTimerID && X_Node_startUpdate();\r
- if( !this._root ){\r
- console.log( 'xnode.x() : not belong tree.' );\r
- return 0;\r
- };\r
- if( this._state & X_Node_State.DISPLAY_NONE ) return 0;\r
+ \r
if( X_UA_DOM.W3C ){\r
// this.css( X_Node_CSS_Unit.px, 'left' );\r
// this.css( X_Node_CSS_Unit.px, 'translateX' );\r
- return this._rawObject.offsetLeft;\r
+ return this._rawObject ? this._rawObject.offsetLeft : 0;\r
} else\r
if( X_UA_DOM.IE4 ){\r
+ // pixelLeft http://www.din.or.jp/~hagi3/JavaScript/JSTips/DHTML/ProbIE5.htm\r
return ( this._rawObject || X_Node__ie4getRawNode( this ) ).offsetLeft;\r
} else {\r
\r
};\r
\r
Node.prototype.y = function(){\r
- if( !this.parent ){\r
- console.log( 'xnode.y() : no parent' );\r
- return 0;\r
- };\r
+ if( ( this._flags & X_Node_State.IN_TREE ) === 0 || this._flags & X_Node_State.STYLE_IS_DISPLAY_NONE ) return 0;\r
+ \r
X_Node_updateTimerID && X_Node_startUpdate();\r
- if( !this._root ){\r
- console.log( 'xnode.y() : not belong tree.' );\r
- return 0;\r
- };\r
- if( this._state & X_Node_State.DISPLAY_NONE ) return 0;\r
+ \r
if( X_UA_DOM.W3C ){\r
// this.css( X_Node_CSS_Unit.px, 'top' );\r
// this.css( X_Node_CSS_Unit.px, 'transisitonY' );\r
- return this._rawObject.offsetTop;\r
+ return this._rawObject ? this._rawObject.offsetTop : 0;\r
} else\r
if( X_UA_DOM.IE4 ){\r
return ( this._rawObject || X_Node__ie4getRawNode( this ) ).offsetTop; \r
};\r
\r
Node.prototype.offset = function( /* xnodeParent */ ){\r
- var x = 0, y = 0, elm;\r
- \r
- if( !this.parent ){\r
- console.log( 'xnode.offset() : no parent' );\r
- return { x : 0, y : 0 };\r
- };\r
- \r
- if( !this._root ){\r
- console.log( 'xnode.offset() : not belong tree.' );\r
- return { x : 0, y : 0 };\r
- };\r
- if( this._state & X_Node_State.DISPLAY_NONE ) return { x : 0, y : 0 };\r
+\r
+ if( ( this._flags & X_Node_State.IN_TREE ) === 0 || this._flags & X_Node_State.STYLE_IS_DISPLAY_NONE ) return { x : 0, y : 0 };\r
\r
if( X.Doc.body === this || X.Doc.html === this ){\r
return { x : 0, y : 0 };\r
X_Node_updateTimerID && X_Node_startUpdate();\r
\r
if( X_UA_DOM.W3C ){\r
- elm = this._rawObject;\r
+ return this._rawObject ? X_Node_getPosition( this._rawObject ) : { x : 0, y : 0 };\r
} else\r
if( X_UA_DOM.IE4 ){\r
- elm = this._rawObject || X_Node__ie4getRawNode( this ); \r
+ return X_Node_getPosition( this._rawObject || X_Node__ie4getRawNode( this ) );\r
} else {\r
\r
};\r
- \r
- return X_Node_getPosition( elm );\r
- \r
- while( elm && elm !== document.body ){\r
- x += elm.offsetLeft;\r
- y += elm.offsetTop;\r
- elm = elm.offsetParent || elm.parentNode || elm.parentElement;\r
- };\r
- return { x : x, y : y };\r
};\r
\r
// エレメントの座標取得 ~スクロール要素~\r
return { x:(pos.left + (body.scrollLeft||html.scrollLeft) - html.clientLeft)\r
, y:(pos.top + (body.scrollTop||html.scrollTop) - html.clientTop) };\r
} :\r
- X.UA.Opera < 10 ?\r
+ X_UA[ 'Opera' ] < 10 ?\r
function( el ){\r
- var ex = 0;\r
- var ey = 0;\r
- do\r
- { \r
- ex += el.offsetLeft;\r
- ey += el.offsetTop;\r
- }\r
- while( el = el.offsetParent );\r
- //\r
- return {x:ex,y:ey};\r
+ var ex = 0;\r
+ var ey = 0;\r
+ do\r
+ { \r
+ ex += el.offsetLeft;\r
+ ey += el.offsetTop;\r
+ }\r
+ while( el = el.offsetParent );\r
+ //\r
+ return {x:ex,y:ey};\r
} :\r
function(target)\r
{\r