How to extend the $.curCss ?
I try to extend the curCss with some navigators names like (moz|webkit).
Here is my code. It add them in the $.support.
But how to extend the $.fn.css and the $.fn.animate with them ?
- // Extend the jQuery.support with normalized names.
- // $.support.css = { Name : (Moz|Webkit)Name }
- jQuery.support.css = (function()
- {
- var
- // Cache
- cache = {},
- body = document.getElementsByTagName('body')[0] ,
- camelcase = function(str){
- return str
- .toString().toLowerCase()
- .replace(/(-)(\w)?/g, function(a,b,c){ return c ? c.toUpperCase() : '' ; })
- .replace( 'Webkit', 'webkit' )
- .replace( 'Kml', 'kml' ) ; // not tested
- },
- standard = function(str){ return str.replace( /^(Moz|kml|webkit|O)(\w)/, function(a,b,c){ return c ? c.toLowerCase() : '' ; } ) },
- view = document.defaultView ;
-
- // Opera // ie not tested
- if ( body.currentStyle )
- {
- var cs = body.currentStyle ;
- for( k in cs ) if( typeof k === 'string' ) cache[ standard(k) ] = k ;
- }
-
- // Moz, Webkit
- else if( view && view.getComputedStyle )
- {
- var k, cs = view.getComputedStyle(body, "" ) || [] ;
- for( k in cs ) if( /\d/.test(k) ) cache[ standard( camelcase(cs[k]) ) ] = camelcase(cs[k]) ;
- }
- // Clear
- camelcase = standard = null ;
- return cache ;
- })() ;
- // Add generics names to jquery support ( $.support.cssBoxShadow... )
- var k, v ;
- for( k in jQuery.support.css )
- {
- if( v = k.match( /transform|transition|boxShadow|borderRadius|column/i ) )
- jQuery.support['css'+v[0]
- .replace( /^.?/, function(a){
- return a.charAt(0).toUpperCase()+a.substr(1); } )] = true ;
- }
- // See $.support in the dom console.
- // New properties are added with a normalized name.
- // if( $.support.cssBoxShadow ) $('div').css( $.support.css.boxShadow, '0 0 5px black' )
- // And i wan't to use a normalized name as:
- // $('div').css( 'boxShadow', '0 0 5px black' )
- // How to do that ?
Thanks.