3 var DOM = ( function( window, document ){
\r
10 function correctNodes( node ){
\r
12 if( node && node.parentNode ){
\r
13 while( node.lastChild ) correctNodes( node.lastChild );
\r
14 node.parentNode.removeChild( node );
\r
15 if( node.nodeType === 1 ){
\r
16 switch( node.tagName ){
\r
18 DIV_LIST.push( node );
\r
21 SPAN_LIST.push( node );
\r
25 node.removeAttribute( 'className' );
\r
26 node.removeAttribute( 'style' );
\r
27 node.removeAttribute( 'id' );
\r
29 if( node.nodeType === 3 ){
\r
31 TEXT_LIST.push( node );
\r
37 createDiv : function(){
\r
38 return 0 < DIV_LIST.length ? DIV_LIST.shift() : document.createElement( 'div' );
\r
40 createSpan : function(){
\r
43 createText : function(){
\r
46 getTextSize : function( elm, content ){
\r
47 var span = DOM.createSpan(),
\r
48 text = DOM.createText(),
\r
50 elm.appendChild( span );
\r
51 span.style.cssText = 'visibility:hidden;position:absolute;';
\r
52 span.appendChild( text );
\r
53 text.data = content;
\r
54 w = span.offsetWidth;
\r
55 h = span.offsetHeight;
\r
56 DOM.correctNodes( span );
\r
59 getTextHeight : function( elm, w, content ){
\r
60 var div = DOM.createSpan(),
\r
61 text = DOM.createText(),
\r
63 elm.appendChild( div );
\r
64 div.style.cssText = 'visibility:hidden;position:absolute;width:' + w + 'px;';
\r
65 div.appendChild( text );
\r
66 text.data = content;
\r
67 w = div.offsetWidth;
\r
68 h = div.offsetHeight;
\r
69 DOM.correctNodes( div );
\r
72 correctNodes : function( node ){
\r
74 if( node && node.parentNode ){
\r
75 while( node.lastChild ) DOM.correctNodes( node.lastChild );
\r
76 node.parentNode.removeChild( node );
\r
77 if( node.nodeType === 1 ){
\r
78 switch( node.tagName ){
\r
80 DIV_LIST.push( node );
\r
83 SPAN_LIST.push( node );
\r
87 node.removeAttribute( 'className' );
\r
88 node.removeAttribute( 'style' );
\r
89 node.removeAttribute( 'id' );
\r
91 if( node.nodeType === 3 ){
\r
93 TEXT_LIST.push( node );
\r
98 })( window, document );
\r
100 var XBrowserStyle = ( function(){
\r
105 UNITS = 'px,cm,mm,in,pt,pc,em,%'.split( ',' ),
\r
106 CLIP_SEPARATOR = UA.isIE === true && UA.ieVersion < 8 ? ' ' : ',';
\r
108 var SPECIAL = ( function(){
\r
110 if( UA.isIE === true && UA.ieVersion < 9 ){
\r
111 if( UA.ACTIVEX === true ){
\r
112 // special.opacity = 'ActiveXOpacity';
\r
113 special.setFilters = function( style ){
\r
114 var filters = ( style.filter || '' ).split( ') ' ),
\r
116 i = filters.length,
\r
117 filter, names, props, prop, j, l, key, v;
\r
119 filter = filters[ --i ].split( ' ' ).join( '' ).split( '(' );
\r
120 if( filter.length !== 2 ) continue;
\r
121 names = filter[ 0 ].split( '.' ); // progid:DXImageTransform.Microsoft.Shadow(color=#666666,direction=120,strength=9)
\r
122 props = filter[ 1 ].split( ',' ); //
\r
124 for( j = 0, l = props.length; j < l; ++j ){
\r
125 prop = props[ j ].split( '=' );
\r
126 key = prop[ 0 ].toLowerCase();
\r
128 filter[ key ] = v; //v.charAt( 0 ) === '#' ? v : parseInt( v );
\r
130 data[ names[ names.length - 1 ] ] = filter;
\r
133 style.filter = data;
\r
134 style.opacity = data.alpha && data.alpha.opacity ? data.alpha.opacity / 100 : 1;
\r
136 special.hasLayout = function( elm ){
\r
137 return elm.currentStyle.hasLayout;
\r
140 special.opacity = null;
\r
143 var style = document.documentElement.style;
\r
144 special.opacity = style.opacity !== undefined ? 'opacity' :
\r
145 style.MozOpacity !== undefined ? 'MozOpacity' :
\r
146 style.KhtmlOpacity !== undefined ? 'KhtmlOpacity' :
\r
147 style[ '-khtml-opacity' ] !== undefined ? 'KhtmlOpacity' : null;
\r
149 // if( style.backgroundPositionX === undefined ){
\r
150 special.setBackgroundPositionXY = function( style ){
\r
151 var bgp = ( style.backgroundPosition || '' ).split( ' ' );
\r
152 style.backgroundPositionX = bgp[ 0 ] || 0;
\r
153 style.backgroundPositionY = bgp[ 1 ] || 0;
\r
156 if( style.clipTop === undefined && style[ 'clip-top' ] === undefined ){
\r
157 special.setClipTopRightBottomLeft = function( style ){
\r
158 var clip = style.clip;
\r
159 if( !cliop || clip.indexOf( 'rect(' ) === -1 ){
\r
161 style.clipRight = 0;
\r
162 style.clipBottom = 0;
\r
163 style.clipLeft = 0;
\r
166 clip = clip.split( '(' )[ 1 ].split( ')' )[ 0 ].split( clip.indexOf( ',' ) !== -1 ? ',' : ' ' );
\r
167 ret.clipTop = clip[ 0 ];
\r
168 ret.clipRight = clip[ 1 ];
\r
169 ret.clipBottom = clip[ 2 ];
\r
170 ret.clipLeft = clip[ 3 ];
\r
177 function cssToObject( css ){
\r
178 var ret = {}, i, nv, n, v,
\r
179 parse = Util.parse,
\r
180 isNumber = Type.isNumber,
\r
181 camelize = Util.camelize;
\r
182 if( Type.isString( css ) === true ){
\r
183 css = css.split( SEMICORON );
\r
184 for( i = css.length; i; ){
\r
185 nv = css[ --i ].split( CORON ); // filter の場合, progid: がくる
\r
187 if( isNumber( parse( n ) ) === true ) continue;
\r
188 v = nv.join( EMPTY );
\r
189 while( v.charAt( 0 ) === ' ' ) v = v.substr( 1 );
\r
190 ret[ camelize( n ) ] = parse( v );
\r
194 if( Type.isNumber( parse( n ) ) === false ) ret[ n ] = parse( css[ n ] );
\r
198 if( SPECIAL.setFilters ){
\r
199 SPECIAL.setFilters( ret );
\r
201 ret.opacity = SPECIAL.opacity !== null ? ret[ SPECIAL.opacity ] : 1;
\r
204 SPECIAL.setBackgroundPositionXY && SPECIAL.setBackgroundPositionXY( ret );
\r
205 SPECIAL.setClipTopRightBottomLeft && SPECIAL.setClipTopRightBottomLeft( ret );
\r
210 var COLOR = ( function(){
\r
211 var ret = {}, v, name,
\r
217 'FFFF00', 'YELLOW',
\r
220 'FF00FF', 'MAGENTA',
\r
221 'FF00FF', 'FUCHSIA',
\r
224 '800080', 'PURPLE',
\r
225 '800000', 'MAROON',
\r
230 'C0C0C0', 'SILVER',
\r
231 '696969', 'DIMGRAY',
\r
232 '708090', 'SLATEGRAY',
\r
233 'A9A9A9', 'DARKGRAY',
\r
234 'DCDCDC', 'GAINSBORO',
\r
235 '191970', 'MIDNIGHTBLUE',
\r
236 '6A5ACD', 'SLATEBLUE',
\r
237 '0000CD', 'MEDIUMBLUE',
\r
238 '4169E1', 'ROYALBLUE',
\r
239 '1E90FF', 'DODGERBLUE',
\r
240 '87CEEB', 'SKYBLUE',
\r
241 '4682B4', 'STEELBLUE',
\r
242 'ADD8E6', 'LIGHTBLUE',
\r
243 'AFEEEE', 'PALETURQUOISE',
\r
244 '40E0D0', 'TURQUOISE',
\r
245 'E0FFFF', 'LIGHTCYAN',
\r
246 '7FFFD4', 'AQUAMARINE',
\r
247 '006400', 'DARKGREEN',
\r
248 '2E8B57', 'SEAGREEN',
\r
249 '90EE90', 'LIGHTGREEN',
\r
250 '7FFF00', 'CHARTREUSE',
\r
251 'ADFF2F', 'GREENYELLOW',
\r
252 '32CD32', 'LIMEGREEN',
\r
253 '9ACD32', 'YELLOWGREEN',
\r
254 '6B8E23', 'OLIVEDRAB',
\r
255 'BCB76B', 'DARKKHAKI',
\r
256 'EEE8AA', 'PALEGOLDENROD',
\r
257 'FFFFE0', 'LIGHTYELLOW',
\r
259 'DAA520', 'GOLDENROD',
\r
260 'B8860B', 'DARKGOLDENROD',
\r
261 'BC8F8F', 'ROSYBROWN',
\r
262 'CD5C5C', 'INDIANRED',
\r
263 '8B4513', 'SADDLEBROWN',
\r
264 'A0522D', 'SIENNA',
\r
266 'DEB887', 'BURLYWOOD',
\r
269 'F4A460', 'SANDYBROWN',
\r
271 'D2691E', 'CHOCOLATE',
\r
272 'B22222', 'FIREBRICK',
\r
274 'FA8072', 'SALMON',
\r
275 'FFA500', 'ORANGE',
\r
277 'FF6347', 'TOMATO',
\r
278 'FF69B4', 'HOTPINK',
\r
280 'FF1493', 'DEEPPINK',
\r
281 'DB7093', 'PALEVIOLETRED',
\r
282 'EE82EE', 'VIOLET',
\r
284 'DA70D6', 'ORCHILD',
\r
285 '9400D3', 'DARKVIOLET',
\r
286 '8A2BE2', 'BLUEVIOLET',
\r
287 '9370DB', 'MEDIUMPURPLE',
\r
288 'D8BFD8', 'THISTLE',
\r
289 'E6E6FA', 'LAVENDER',
\r
290 'FFE4E1', 'MISTYROSE',
\r
292 'FFFACD', 'LEMONCHIFFON'
\r
294 for( i = list.length; i; ){
\r
296 name = list[ --i ];
\r
297 ret[ name ] = parseInt( v, 16 );
\r
302 var PARAMS = ( function(){
\r
304 register( ret.percent = {},
\r
305 'marginBottom,marginLeft,marginRight,marginTop,paddingBottom,paddingLeft,paddingRight,paddingTop,fontSize,textIndent'
\r
307 register( ret.offset = {},
\r
308 'height,width,bottom,left,right,top'
\r
310 register( ret.size = {},
\r
311 'borderBottomWidth,borderLeftWidth,borderRightWidth,borderTopWidth,letterSpacing'
\r
313 register( ret.color = {},
\r
314 'backgroundColor,borderBottomColor,borderLeftColor,borderRightColor,borderTopColor,color'
\r
316 register( ret.region = {},
\r
317 'margin,padding,borderWidth,borderColor'
\r
319 register( ret.special = {},
\r
320 'clip,backgroundPosition,opacity,lineHeight,zIndex'
\r
322 register( ret.unit = {}, 'px,cm,mm,in,pt,pc,em,%' );
\r
324 register( ret.margin = {}, 'marginBottom,marginLeft,marginRight,marginTop,paddingBottom' );
\r
325 register( ret.padding = {}, 'paddingBottom,paddingLeft,paddingRight,paddingTop' );
\r
326 register( ret.borderWidth = {}, 'borderBottomWidth,borderLeftWidth,borderRightWidth,borderTopWidth' );
\r
327 register( ret.borderColor = {}, 'borderBottomColor,borderLeftColor,borderRightColor,borderTopColor' );
\r
329 function register( obj, params ){
\r
330 params = params.split( ',' );
\r
331 for( var i=params.length; i; ) obj[ params[ --i ] ] = true;
\r
339 var Property = Class.create(
\r
343 Constructor : function( name, value, unit, pxPerEm ){
\r
345 this.value = value;
\r
347 this.pxPerEm = pxPerEm; // XXpx = 1em;
\r
351 pxPerEm : 12, // 1em === ??px
\r
353 equal : function( prop ){
\r
354 if( this.unit === prop.unit ){
\r
355 return this.value === prop.value;
\r
357 return Math.abs( this.toPx() - prop.toPx() ) < 1;
\r
359 convert: function( prop ){
\r
360 var u = prop.unit, v;
\r
361 if( this.unit === u ) return;
\r
362 this.value = v = this.toPx();
\r
365 this.value = u === 'em' ? v / this.pxPerEm : Util.pxTo( v, u );
\r
368 setValue: function( v ){
\r
371 getValue: function(){
\r
374 getOffset: function( prop ){
\r
375 return prop.value - this.value;
\r
377 getUnit: function(){
\r
380 getValueText: function(){
\r
381 return this.value === 0 ? '0' : this.value + this.unit;
\r
384 var v = this.value, u = this.unit;
\r
385 if( u === px ) return v;
\r
386 if( u === 'em' ) return v * this.pxPerEm;
\r
387 if( u === '' && this.name === 'lineHeight' ) return v * this.pxPerEm;
\r
388 return Util.toPx( v, u );
\r
390 isValid: function( t ){
\r
395 z = u !== '' ? true : v === 0;
\r
396 if( PARAMS.percent[ n ] === true ) return z;
\r
397 if( PARAMS.offset[ n ] === true ) return z;
\r
398 if( PARAMS.size[ n ] === true ) return z && u !== '%';
\r
399 if( PARAMS.special[ n ] === true ){
\r
400 if( n === 'lineHeight' ) return true;
\r
401 if( n === 'opacity' ) return 0 <= v && v <= 1 && u === '';
\r
402 if( n === 'zIndex' ) return u === '';
\r
410 * backgroundPosition, clip
\r
412 var PropertyGroup = Class.create(
\r
416 Constructor : function( name ){
\r
419 for( var i = 1, l = arguments.length; i<l; ++i ){
\r
420 this.props.push( arguments[ i ] );
\r
424 equal : function( prop ){
\r
425 var ps = this.props, i = ps.length;
\r
428 if( ps[ i ].equal( prop[ i ] ) === false ) return false;
\r
432 convert : function( prop ){
\r
433 var ps = this.props, i = ps.length;
\r
436 ps[ i ].convert( prop[ i ] );
\r
439 setValue : function( ary ){
\r
440 var ps = this.props, i = 0, l = ps.length;
\r
442 ps[ i ].setValue( ary[ i ] );
\r
445 getValue : function(){
\r
446 var ret = [], ps = this.props, i = 0, l = ps.length;
\r
448 ret.push( ps[ i ].getValue() );
\r
452 getOffset : function( prop ){
\r
459 ret.push( ps[ i ].getOffset( _ps[ i ] ) );
\r
463 getUnit : function(){
\r
464 var ret = [], ps = this.props, i = 0, l = ps.length;
\r
466 ret.push( ps[ i ].getUnit() );
\r
470 getValueText : function(){
\r
471 var ret = [], ps = this.props, i = 0, l = ps.length;
\r
473 ret.push( ps[ i ].getValueText() );
\r
475 if( this.name === 'clip' ){
\r
476 return 'rect(' + ret.join( CLIP_SEPARATOR ) + ')';
\r
478 return ret.join( ' ' );
\r
480 onKill : function(){
\r
481 var ps = this.props, i = ps.length;
\r
486 isValid : function( t ){
\r
488 var ps = t.props, i = ps.length;
\r
490 if( ps[ --i ].isValid() === false ) return false;
\r
498 * margin, padding, borderWidth, borderColor
\r
500 var FrexibleProperty = PropertyGroup.inherits(
\r
501 'FrexibleProperty',
\r
502 Class.POOL_OBJECT, {
\r
503 Constructor : function( name ){
\r
506 for( var i = 1, l = arguments.length; i<l; ++i ){
\r
507 this.props.push( arguments[ i ] );
\r
509 // top, bottom, left, right, topbottom, leftright, all
\r
514 var ColorProperty = Class.create(
\r
516 Class.POOL_OBJECT, {
\r
517 Constructor : function( name, r, g, b, pct ){
\r
525 equal : function( prop ){
\r
526 if( this.pct === prop.pct ){
\r
527 return this.r === prop.r && this.g === prop.g && this.b === prop.b;
\r
529 var rgb = this._toPct(),
\r
530 _rgb = prop._toPct(),
\r
534 if( Math.abs( rgb[ i ] - _rgb[ i ] ) > 1 ) return false;
\r
538 convert : function( prop ){
\r
539 var u = prop.pct, x;
\r
540 if( this.pct === u ) return;
\r
541 x = u === true ? 100 / 255 : 2.55;
\r
547 setValue : function( rgb ){
\r
552 getValue : function(){
\r
553 return [ this.r, this.g, this.b ];
\r
555 getOffset : function( prop ){
\r
556 return [ prop.r - this.r, prop.g - this.g, prop.b - this.b ];
\r
558 getUnit : function(){
\r
559 return this.pct === true ? '%' : '';
\r
561 getValueText : function(){
\r
562 if( this.pct === true ){
\r
563 return [ 'rgb(', this.r, '%,', this.g, '%,', this.b, '%)' ].join( '' );
\r
565 var round = Math.round;
\r
566 //return [ 'rgb(', round( this.r ), ',', round( this.g ), ',', round( this.b ), ')' ].join( '' );
\r
568 var rgb = '00000' + ( ( round( this.r ) << 16 ) + ( round( this.g ) << 8 ) + round( this.b ) ).toString( 16 );
\r
569 return '#' + rgb.substr( rgb.length - 6 );
\r
571 _toPct : function(){
\r
572 if( this.pct === true ) return [ this.r, this.g, this.b ];
\r
573 return [ this.r / 2.55, this.g / 2.55, this.b / 2.55 ];
\r
575 isValid : function( t ){
\r
576 var isFinite = window.isFinite;
\r
577 if( !isFinite( this.r ) || !isFinite( this.g ) || !isFinite( this.b ) ) return false;
\r
578 if( 0 > this.r || 0 > this.g || 0 > this.b ) return false;
\r
579 if( this.pct === true ) return this.r <= 100 && this.g <= 100 && this.b <= 100;
\r
580 return this.r <= 255 && this.g <= 255 && this.b <= 255;
\r
585 var isString = Type.isString,
\r
586 isNumber = Type.isNumber;
\r
587 var REG_UINIT = /.*\d(\w{1,2})?/,
\r
590 REG_XXXXXX = /^#[\da-fA-F]{6}?/,
\r
591 REG_XXX = /^#[\da-fA-F]{3}?/;
\r
593 var WrappedStyle = Class.create(
\r
597 Constructor : function( style ){
\r
598 this.style = style;
\r
599 var fontsize = this.get( 'fontSize' );
\r
600 this.pxPerEm = fontsize.toPx();
\r
603 get: function( p ){
\r
604 if( PARAMS.special[ p ] === true || PARAMS.region[ p ] === true ){
\r
605 if( p === 'clip' ) return this.getClip();
\r
606 if( p === 'margin' ) return this.getMarginPaddingBorder( p, '' );
\r
607 if( p === 'padding' ) return this.getMarginPaddingBorder( p, '' );
\r
608 if( p === 'borderWidth' ) return this.getMarginPaddingBorder( 'border', 'Width' );
\r
609 if( p === 'borderColor' ) return this.getBorderColor( 'borderColor' );
\r
610 if( p === 'backgroundPosition' ) return this.getBackgroundPosition( p );
\r
611 // opacity, zindex, lineHeight
\r
612 return new Property( p, this.getValue( x ), this.getUnit( x ), this.pxPerEm );
\r
614 var x = this.style[ p ], e, v, u;
\r
615 if( PARAMS.offset[ p ] === true ){
\r
616 return new Property( p, this.getValue( x ), this.getUnit( x, p ), this.pxPerEm );
\r
619 if( p === 'width' ) v = e.offsetWidth;
\r
620 if( p === 'height' ) v = e.offsetHeight;
\r
621 if( p === 'top' ) v = e.offsetTop;
\r
622 if( p === 'bottom' ) v = e.offsetBottom;
\r
623 if( p === 'left' ) v = e.offsetLeft;
\r
624 if( p === 'right' ) v = e.offsetRight;
\r
625 u = this.getUnit( x, p );
\r
626 // alert( p + this.pxTo( v, u ) + u )
\r
627 return new Property( p, this.pxTo( v, u ), u, this.pxPerEm ); */
\r
629 if( p === 'fontSize' ){ // xx-small 等
\r
630 v = Util.absoluteFontSizeToPx( x );
\r
632 return new Property( p, v, px, this.pxPerEm );
\r
635 if( PARAMS.percent[ p ] === true ){
\r
636 // alert( p + ' , ' + x + ' , ' + this.getUnit( x, p ) )
\r
637 return new Property( p, this.getValue( x ), this.getUnit( x, p ), this.pxPerEm );
\r
639 if( PARAMS.size[ p ] === true ){
\r
640 return new Property( p, this.getValue( x ), this.getUnit( x, p ), this.pxPerEm );
\r
642 if( PARAMS.color[ p ] === true ){
\r
643 return this.getColor( x, p );
\r
646 pxTo: function( px, unit ){
\r
647 if( unit === 'em' ) return px / this.pxPerEm;
\r
648 return Util.pxTo( px, unit );
\r
650 getValue: function( x ){
\r
651 return isString( x ) === true ? parseInt( x ) :
\r
652 isNumber( x ) === true ? x : 0;
\r
654 getUnit: function( x, p ){
\r
656 if( isString( x ) === true ){
\r
657 u = x.replace( REG_UINIT, $1 );
\r
658 if( p === 'lineHeight' ) return u;
\r
659 if( PARAMS.unit[ u ] !== true ) return px;
\r
664 getColor: function( x, p ){
\r
665 var rgb = COLOR[ x.toUpperCase() ],
\r
670 if( isNumber( rgb ) === true ){
\r
671 r = ( rgb & 0xff0000 ) >> 16;
\r
672 g = ( rgb & 0xff00 ) >> 8;
\r
673 b = ( rgb & 0xff );
\r
675 if( x.match( REG_XXXXXX ) ){
\r
676 r = parseInt( x.charAt( 1 ) + x.charAt( 2 ), 16 );
\r
677 g = parseInt( x.charAt( 3 ) + x.charAt( 4 ), 16 );
\r
678 b = parseInt( x.charAt( 5 ) + x.charAt( 6 ), 16 );
\r
679 //alert( x + ' g: ' + g )
\r
681 if( x.match( REG_XXX ) ){
\r
682 r = parseInt( x.charAt( 1 ) + x.charAt( 1 ), 16 );
\r
683 g = parseInt( x.charAt( 2 ) + x.charAt( 2 ), 16 );
\r
684 b = parseInt( x.charAt( 3 ) + x.charAt( 3 ), 16 );
\r
686 if( x.indexOf( 'rgb(' ) === 0 ){
\r
687 rgb = x.substr( 4 ).split( ',' );
\r
688 r = parseFloat( rgb[ 0 ] );
\r
689 g = parseFloat( rgb[ 1 ] );
\r
690 b = parseFloat( rgb[ 2 ] );
\r
691 if( x.indexOf( '%' ) !== -1 ) pct = true;
\r
697 return new ColorProperty( p, r, g, b, pct );
\r
699 getClip: function( name ){
\r
700 // rect(...) クリップします。<top>, <bottom> は上端からの、 <right>, <left> は左端からのオフセットで指定します。Internet Explorer 4~7 では、カンマの代わりにスペースで区切る必要があります。
\r
701 // position:absolute または position:fixed を適用した要素に対してのみ有効です。
\r
702 var top = this.get( name + 'Top' ),
\r
703 right = this.get( name + 'Right' ),
\r
704 bottom = this.get( name + 'Bottom' ),
\r
705 left = this.get( name + 'Left' ),
\r
706 ret = new PropertyGroup( name, top, right, bottom, left),
\r
708 if( ret.isValid() === true ) return ret;
\r
710 all = this.style[ name ].split( '(' )[ 1 ].split( ')' )[ 0 ].split( CLIP_SEPARATOR );
\r
711 return new PropertyGroup( name,
\r
712 new Property( name + 'Top', all[ 0 ], px, this.pxPerEm ),
\r
713 new Property( name + 'Right', all[ 1 ], px, this.pxPerEm ),
\r
714 new Property( name + 'Bottom', all[ 2 ], px, this.pxPerEm ),
\r
715 new Property( name + 'Left', all[ 3 ], px, this.pxPerEm )
\r
718 getBackgroundPosition: function( name ){
\r
719 var x = this.get( name + 'X' ),
\r
720 y = this.get( name + 'Y' ),
\r
721 ret = new PropertyGroup( name, x, y ),
\r
723 if( ret.isValid() === true ) return ret;
\r
725 xy = this.style[ name ].split( ' ' );
\r
726 return new PropertyGroup( name,
\r
727 new Property( name + 'X', this.getValue( xy[ 0 ] ), this.getUnit( xy[ 0 ] ), this.pxPerEm ),
\r
728 new Property( name + 'Y', this.getValue( xy[ 1 ] ), this.getUnit( xy[ 1 ] ), this.pxPerEm )
\r
731 getMarginPaddingBorder: function( name, width ){
\r
732 var props = [ name + 'Top' + width,
\r
733 name + 'Right' + width,
\r
734 name + 'Bottom' + width,
\r
735 name + 'Left' + width ],
\r
736 top = this.get( props[ 0 ] ),
\r
737 right = this.get( props[ 1 ] ),
\r
738 bottom = this.get( props[ 2 ] ),
\r
739 left = this.get( props[ 3 ] ),
\r
740 ret = new FrexibleProperty( name, top, right, bottom, left ),
\r
741 klass, pxPerEm, getValue, getUnit,
\r
742 all, _0, _1, _2, _3, v, u;
\r
743 if( ret.isValid() === true ) return ret;
\r
746 pxPerEm = this.pxPerEm;
\r
747 getValue = this.getValue;
\r
748 getUnit = this.getUnit;
\r
749 all = this.style[ name + width ].split( ' ' );
\r
754 v = getValue( _0 );
\r
756 switch( all.length ){
\r
758 top = new klass( props[ 0 ], v, u, pxPerEm );
\r
759 right = new klass( props[ 1 ], v, u, pxPerEm );
\r
760 bottom = new klass( props[ 2 ], v, u, pxPerEm );
\r
761 left = new klass( props[ 3 ], v, u, pxPerEm );
\r
764 top = new klass( props[ 0 ], v, u, pxPerEm );
\r
765 bottom = new klass( props[ 2 ], v, u, pxPerEm );
\r
766 v = getValue( _1 );
\r
768 right = new klass( props[ 1 ], v, u, pxPerEm );
\r
769 left = new klass( props[ 3 ], v, u, pxPerEm );
\r
772 top = new klass( props[ 0 ], v, u, pxPerEm );
\r
773 v = getValue( _1 );
\r
775 right = new klass( props[ 1 ], v, u, pxPerEm );
\r
776 left = new klass( props[ 3 ], v, u, pxPerEm );
\r
777 bottom = new klass( props[ 2 ], getValue( _2 ), getUnit( _2 ), pxPerEm );
\r
780 top = new klass( props[ 0 ], v, u, pxPerEm );
\r
781 right = new klass( props[ 1 ], getValue( _1 ), getUnit( _1 ), pxPerEm );
\r
782 bottom = new klass( props[ 2 ], getValue( _2 ), getUnit( _2 ), pxPerEm );
\r
783 left = new klass( props[ 3 ], getValue( _3 ), getUnit( _3 ), pxPerEm );
\r
786 return new FrexibleProperty( name, top, right, bottom, left );
\r
788 getBorderColor: function( name ){
\r
789 var props = 'borderTopColor,borderRightColor,borderBottomColor,borderLeftColor'.split( ',' ),
\r
790 top = this.get( props[ 0 ] ),
\r
791 right = this.get( props[ 1 ] ),
\r
792 bottom = this.get( props[ 2 ] ),
\r
793 left = this.get( props[ 3 ] ),
\r
794 ret = new FrexibleProperty( name, top, right, bottom, left ),
\r
795 all, _0, _1, getColor;
\r
796 if( ret.isValid() === true ) return ret;
\r
798 getColor = this.getColor;
\r
799 all = this.style[ name ].split( ' ' );
\r
802 switch( all.length ){
\r
804 top = getColor( _0, props[ 0 ] );
\r
805 right = getColor( _0, props[ 1 ] );
\r
806 bottom = getColor( _0, props[ 2 ] );
\r
807 left = getColor( _0, props[ 3 ] );
\r
810 top = getColor( _0, props[ 0 ] );
\r
811 right = getColor( _1, props[ 1 ] );
\r
812 bottom = getColor( _0, props[ 2 ] );
\r
813 left = getColor( _1, props[ 3 ] );
\r
816 top = getColor( _0, props[ 0 ] );
\r
817 right = getColor( _1, props[ 1 ] );
\r
818 bottom = getColor( all[ 2 ], props[ 2 ] );
\r
819 left = getColor( _1, props[ 3 ] );
\r
822 top = getColor( _0, props[ 0 ] );
\r
823 right = getColor( _1, props[ 1 ] );
\r
824 bottom = getColor( all[ 2 ], props[ 2 ] );
\r
825 left = getColor( all[ 3 ], props[ 3 ] );
\r
828 return new FrexibleProperty( name, top, right, bottom, left );
\r
832 function camelizeHash( obj ){
\r
833 var p, _p, came = Util.camelize;
\r
836 if( _p === p ) continue;
\r
837 obj[ _p ] = obj[ _p ] || obj[ p ];
\r
842 create: function( css ){
\r
843 return new WrappedStyle( camelizeHash( p ) );
\r
848 var XDocument = ( function( window, document ){
\r
850 var ROOT_LIST = [];
\r
851 var AUTO = Number.POSITIVE_INFINITY;
\r
852 var FULL = X.Css.Attr; // something unigue value;
\r
853 var FLOOR = Math.floor;
\r
855 var RootNode = Node.inherits(
\r
860 Constructor : function(){
\r
861 RootNode.newPrivateData( this, BasicLayoutManager );
\r
866 })( window, document );