rmsie = /(msie) ([\w.]+)/,
rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,
+ // Matches dashed string for camelizing
+ rdashAlpha = /-([a-z])/ig,
+
+ // Used by jQuery.camelCase as callback to replace()
+ fcamelCase = function( all, letter ) {
+ return letter.toUpperCase();
+ },
+
// Keep a UserAgent string for use with jQuery.browser
userAgent = navigator.userAgent,
}
},
+ // Converts a dashed string to camelCased string;
+ // Used by both the css and data modules
+ camelCase: function( string ) {
+ return string.replace( rdashAlpha, fcamelCase );
+ },
+
nodeName: function( elem, name ) {
return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();
},
var ralpha = /alpha\([^)]*\)/i,
ropacity = /opacity=([^)]*)/,
- rdashAlpha = /-([a-z])/ig,
// fixed for IE9, see #8346
rupper = /([A-Z]|^ms)/g,
rnumpx = /^-?\d+(?:px)?$/i,
curCSS,
getComputedStyle,
- currentStyle,
-
- fcamelCase = function( all, letter ) {
- return letter.toUpperCase();
- };
+ currentStyle;
jQuery.fn.css = function( name, value ) {
// Setting 'undefined' is a no-op
for ( name in options ) {
elem.style[ name ] = old[ name ];
}
- },
-
- camelCase: function( string ) {
- return string.replace( rdashAlpha, fcamelCase );
}
});
});
});
+
+test("jQuery.camelCase()", function() {
+
+ var tests = {
+ "foo-bar": "fooBar",
+ "foo-bar-baz": "fooBarBaz"
+ };
+
+ expect(2);
+
+ jQuery.each( tests, function( key, val ) {
+ equal( jQuery.camelCase( key ), val, "Converts: " + key + " => " + val );
+ });
+});