OSDN Git Service

Version 0.6.73, move ._rawNode from X.Dom.Event to X.EventDispatcher.
[pettanr/clientJs.git] / 0.6.x / js / 01_dom / 15_XDomStyle.js
index 4977e24..968557b 100644 (file)
@@ -119,14 +119,15 @@ _GRNERAL
                        FIX_PROP      = me.SPECIAL_FIX_PROP,
                        SPECIAL_FIX   = me.SPECIAL_FIX,
                        n             = -1,
-                       p, name, sp;
+                       p, v, name, sp;
                if( !obj ) return ''; // Opera7.5 未満?
                for( p in obj ){
-                       name = uncamelize( p );
+                       // TODO Object が拡張されていると error...
+                       name = uncamelize( VENDER_PREFIX[ p ] || p );
                        if( FIX_PROP[ name ] ){
-                               sp = 1;
+                               sp = true;
                        } else {
-                               css[ ++n ] = [ VENDER_PREFIX[ name ] || name, obj[ p ] ].join( ':' );
+                               css[ ++n ] = [ name, obj[ p ] ].join( ':' );
                        };
                };
                sp && ( css[ ++n ] = 'filter:' + SPECIAL_FIX( obj ) );
@@ -1183,44 +1184,51 @@ X.Dom.Node.prototype._getCharSize =
 
 
 X.Dom.listenOnce( X.Dom.Event.DOM_PRE_INIT, function(){
-       var testStyle = X.Dom._root.style;
+       var testStyle = X.Dom._root.style,
+               temp      = testStyle.cssText;
        
        X.Dom.Style.VENDER_PREFIX = (function(){
                var ret       = {},
-                       vendors   = 'webkit,Webkit,Moz,moz,ms,Ms,O,o,khtml,Khtml'.split( ',' ),
-                       searches  =
+                       vendors   = 'webkit,Webkit,Moz,moz,Ms,ms,O,o,khtml,Khtml'.split( ',' ),
+                       searches  = (
                                'opacity,boxSizing,' +
                                'transform,transformOrigin,perspective,' +
                                'transisiton,transitionDelay,transitionProperty,transitionDuration,transitionTimingFunction,' +
-                               'userSelect,touchAction,touchCallout,contentZooming,userDrag,tapHighlightColor'.split( ',' ),
-                       vendor, i, search, prop;
-               // 
-               vendors.unshift( '' );
-               
-               function findVenderPrefix( prop ){
-                       var v, i = vendors.length;
-                       vendor = null;
-                       for( ; i; ){
-                               v = vendors[ --i ];
-                               if( testStyle[ v + prop ] !== undefined ){
-                                       vendor = v;
-                                       return v + prop;
-                               };
-                       };      
-               };
-               
+                               'userSelect,touchSelect,touchAction,touchCallout,contentZooming,userDrag,tapHighlightColor' ).split( ',' ),
+                       vendor, i, search, prop, j, v;
+
                for( i = searches.length; i; ){
-                       search = searches[ --i ];
-                       prop = findVenderPrefix( search );
-                       if( search === 'transform' ) ret.transVender = vendor;
-                       if( prop ) ret[ search ] = prop;
+                       search = prop = searches[ --i ];
+                       
+                       if( testStyle[ prop ] === undefined ){
+                               prop = prop.charAt( 0 ).toUpperCase() + prop.substr( 1 );
+                               for( j = vendors.length; j; ){
+                                       v = vendors[ --j ];
+                                       if( testStyle[ v + prop ] !== undefined ){
+                                               if( v === 'ms' ) v = 'Ms';// for ie9
+                                               if( v === 'o' ) v = 'O';//for opera12
+                                               ret[ search ] = v + prop;
+                                               break;
+                                       };
+                               };                              
+                       } else {
+                               ret[ search ] = prop;
+                       };
                };
                return ret;
        })();
        
+       testStyle.cssText = 'background:rgba(0,0,0,0.5)';
+       
+       X.Dom.Style.Support = {
+               rgba : !!testStyle.background
+       };
+       
+       testStyle.cssText = temp;
+       
        X.Dom.Style.SPECIAL_FIX_PROP =
                // ~IE8
-               X.UA.IE && X.UA.IE < 9 && !X.UA.MacIE ?
+               X.UA.IE < 9 && !X.UA.MacIE ?
                        {
                                filter          : 1,
                                opacity         : 2//, uinode ChromeNode で行う
@@ -1229,7 +1237,7 @@ X.Dom.listenOnce( X.Dom.Event.DOM_PRE_INIT, function(){
                                //backgroundImage : 5
                        } :
                // IE9
-               X.UA.IE && 9 <= X.UA.IE && X.UA.IE < 10 ?
+               9 <= X.UA.IE && X.UA.IE < 10 ?
                        {
                                filter          : 1//,
                                //textShadow      : 1