8 boxSizingEnabled : false,
\r
10 // TODO: offsetLeft, offsetTop の基準位置
\r
17 X.Dom.listenOnce( X.Dom.Event.DOM_INIT, function(){
\r
19 var elm = Node._systemNode._rawNode || Node._systemNode._ie4getRawNode();
\r
20 elm.style.cssText = 'width:10px;padding:1px;border:2px solid #0;margin:4px;';
\r
22 X.Dom.BoxModel.defaultBoxModel = elm.offsetWidth === 10 ?
\r
23 X.Dom.BoxModel.BORDER_BOX :
\r
24 X.Dom.BoxModel.CONTENT_BOX;
\r
26 if( X.Dom.BoxModel.defaultBoxModel === X.Dom.BoxModel.CONTENT_BOX ){
\r
27 elm.style.cssText += 'box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing: border-box;-o-box-sizing:border-box;-ms-box-sizing:border-box;';
\r
29 X.Dom.BoxModel.boxSizingEnabled = elm.offsetWidth === 10;
\r
36 elm.style.cssText = 'width:90px;height:90px;overflow:auto;';
\r
37 elm.innerHTML = '<div style="width:100px;height:100px;"></div>';
\r
39 X.Dom.BoxModel.vScrollbarSize = 90 - elm.clientWidth;
\r
40 X.Dom.BoxModel.hScrollbarSize = 90 - elm.clientHeight;
\r
42 elm.style.cssText = 'position:absolute;top:0;left:0;margin:1px;border:2px solid #000;padding:4px;';
\r
43 elm.children[ 0 ].style.cssText = 'position:absolute;top:8px;left:8px;margin:16px;border:32px solid #666;padding:64px;';
\r
45 X.Dom.BoxModel.absoluteOffset = elm.children[ 0 ].offsetTop;
\r
47 elm.style.cssText = elm.innerHTML = '';
\r
50 /* --------------------------------------
\r
52 * display:blobk かつ overflow:hidden かつ size(px,em)が設定されていたら、再描画しないでその値を返す
\r
55 Node.prototype.width = function(){
\r
56 if( !this.parent ){// todo : _state で tree に所属しているか?判定
\r
57 console.log( 'xnode.width() : no parent' );
\r
60 Node.root._updateTimerID && Node.root._startUpdate();
\r
62 console.log( 'xnode.width() : not belong tree.' );
\r
65 if( this._state & X.Dom.State.DISPLAY_NONE ) return 0;
\r
66 if( document.getElementById ){
\r
67 // this.css( X.Dom.Style.Unit.px, 'width' );
\r
68 return this._rawNode.offsetWidth;
\r
71 return ( this._rawNode || this._ie4getRawNode() ).offsetWidth;
\r
77 Node.prototype.height = function(){
\r
79 console.log( 'xnode.height() : no parent' );
\r
82 Node.root._updateTimerID && Node.root._startUpdate();
\r
84 console.log( 'xnode.height() : not belong tree.' );
\r
87 if( this._state & X.Dom.State.DISPLAY_NONE ) return 0;
\r
88 if( document.getElementById ){
\r
89 // this.css( X.Dom.Style.Unit.px, 'height' );
\r
90 return this._rawNode.offsetHeight;
\r
93 return ( this._rawNode || this._ie4getRawNode() ).offsetHeight;
\r
99 Node.prototype.scrollWidth = function(){
\r
100 if( !this.parent ){// todo : _state で tree に所属しているか?判定
\r
101 console.log( 'xnode.width() : no parent' );
\r
104 Node.root._updateTimerID && Node.root._startUpdate();
\r
106 console.log( 'xnode.width() : not belong tree.' );
\r
109 if( this._state & X.Dom.State.DISPLAY_NONE ) return 0;
\r
110 if( document.getElementById ){
\r
111 // this.css( X.Dom.Style.Unit.px, 'width' );
\r
112 return this._rawNode.scrollWidth;
\r
114 if( document.all ){
\r
115 return ( this._rawNode || this._ie4getRawNode() ).scrollWidth;
\r
121 Node.prototype.scrollHeight = function(){
\r
122 if( !this.parent ){
\r
123 console.log( 'xnode.height() : no parent' );
\r
126 Node.root._updateTimerID && Node.root._startUpdate();
\r
128 console.log( 'xnode.height() : not belong tree.' );
\r
131 if( this._state & X.Dom.State.DISPLAY_NONE ) return 0;
\r
132 if( document.getElementById ){
\r
133 // this.css( X.Dom.Style.Unit.px, 'height' );
\r
134 return this._rawNode.scrollHeight;
\r
136 if( document.all ){
\r
137 return ( this._rawNode || this._ie4getRawNode() ).scollHeight;
\r
144 /* --------------------------------------
\r
146 * position:absolute かつ x か y が設定されていたら、再描画しないで css オブジェクトから計算した値を返す。 float は?
\r
147 * position:absolute の指定で自動で top,left を補う必要あり? -> X.Dom.Style
\r
148 * 親要素 border 外側からの値。 IE, Firefox, Safari, Chrome の offsetLeft/Topでは、border 内側なので補正する。
\r
149 * transformX, Y は加える? アニメーション中は?
\r
151 // X.Dom.Style.transform,
\r
152 Node.prototype.x = function(){
\r
153 if( !this.parent ){
\r
154 console.log( 'xnode.x() : no parent' );
\r
157 Node.root._updateTimerID && Node.root._startUpdate();
\r
159 console.log( 'xnode.x() : not belong tree.' );
\r
162 if( this._state & X.Dom.State.DISPLAY_NONE ) return 0;
\r
163 if( document.getElementById ){
\r
164 // this.css( X.Dom.Style.Unit.px, 'left' );
\r
165 // this.css( X.Dom.Style.Unit.px, 'translateX' );
\r
166 return this._rawNode.offsetLeft;
\r
168 if( document.all ){
\r
169 return ( this._rawNode || this._ie4getRawNode() ).offsetLeft;
\r
175 Node.prototype.y = function(){
\r
176 if( !this.parent ){
\r
177 console.log( 'xnode.y() : no parent' );
\r
180 Node.root._updateTimerID && Node.root._startUpdate();
\r
182 console.log( 'xnode.y() : not belong tree.' );
\r
185 if( this._state & X.Dom.State.DISPLAY_NONE ) return 0;
\r
186 if( document.getElementById ){
\r
187 // this.css( X.Dom.Style.Unit.px, 'top' );
\r
188 // this.css( X.Dom.Style.Unit.px, 'transisitonY' );
\r
189 return this._rawNode.offsetTop;
\r
191 if( document.all ){
\r
192 return ( this._rawNode || this._ie4getRawNode() ).offsetTop;
\r