JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.0.1
[ckeditor.git] / _source / core / tools.js
index 29b34b4..6f95428 100644 (file)
@@ -197,18 +197,27 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                 * alert( CKEDITOR.tools.cssStyleToDomStyle( 'background-color' ) );  // "backgroundColor"\r
                 * alert( CKEDITOR.tools.cssStyleToDomStyle( 'float' ) );             // "cssFloat"\r
                 */\r
-               cssStyleToDomStyle : function( cssName )\r
+               cssStyleToDomStyle : ( function()\r
                {\r
-                       if ( cssName == 'float' )\r
-                               return 'cssFloat';\r
-                       else\r
+                       var test = document.createElement( 'div' ).style;\r
+\r
+                       var cssFloat = ( typeof test.cssFloat != 'undefined' ) ? 'cssFloat'\r
+                               : ( typeof test.styleFloat != 'undefined' ) ? 'styleFloat'\r
+                               : 'float';\r
+\r
+                       return function( cssName )\r
                        {\r
-                               return cssName.replace( /-./g, function( match )\r
-                                       {\r
-                                               return match.substr( 1 ).toUpperCase();\r
-                                       });\r
-                       }\r
-               },\r
+                               if ( cssName == 'float' )\r
+                                       return cssFloat;\r
+                               else\r
+                               {\r
+                                       return cssName.replace( /-./g, function( match )\r
+                                               {\r
+                                                       return match.substr( 1 ).toUpperCase();\r
+                                               });\r
+                               }\r
+                       };\r
+               } )(),\r
 \r
                /**\r
                 * Replace special HTML characters in a string with their relative HTML\r