Skip to content
Permalink
Browse files

Landing pull request 463. Fixes #9572. Don't camelize the `-ms-` pref…

…ix because Microsoft didn't. A Fixes #9572.

More Details:
 - #463
 - http://bugs.jquery.com/ticket/9572
  • Loading branch information...
dmethvin authored and timmywil committed Aug 17, 2011
1 parent 130a29e commit 1a738cb72fa9f8b7280f15586a68ef9377b18976
Showing with 11 additions and 5 deletions.
  1. +4 −3 src/core.js
  2. +7 −2 test/unit/core.js
@@ -47,6 +47,7 @@ var jQuery = function( selector, context ) {

// Matches dashed string for camelizing
rdashAlpha = /-([a-z]|[0-9])/ig,
rmsPrefix = /^-ms-/,

// Used by jQuery.camelCase as callback to replace()
fcamelCase = function( all, letter ) {
@@ -590,10 +591,10 @@ jQuery.extend({
}
},

// Converts a dashed string to camelCased string;
// Used by both the css and data modules
// Convert dashed to camelCase; used by the css and data modules
// Microsoft forgot to hump their vendor prefix (#9572)
camelCase: function( string ) {
return string.replace( rdashAlpha, fcamelCase );
return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
},

nodeName: function( elem, name ) {
@@ -1129,10 +1129,15 @@ test("jQuery.camelCase()", function() {

var tests = {
"foo-bar": "fooBar",
"foo-bar-baz": "fooBarBaz"
"foo-bar-baz": "fooBarBaz",
"girl-u-want": "girlUWant",
"the-4th-dimension": "the4thDimension",
"-o-tannenbaum": "OTannenbaum",
"-moz-illa": "MozIlla",
"-ms-take": "msTake"
};

expect(2);
expect(7);

jQuery.each( tests, function( key, val ) {
equal( jQuery.camelCase( key ), val, "Converts: " + key + " => " + val );

0 comments on commit 1a738cb

Please sign in to comment.
You can’t perform that action at this time.