File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ var jQuery = function( selector, context ) {
47
47
48
48
// Matches dashed string for camelizing
49
49
rdashAlpha = / - ( [ a - z ] | [ 0 - 9 ] ) / ig,
50
+ rmsPrefix = / ^ - m s - / ,
50
51
51
52
// Used by jQuery.camelCase as callback to replace()
52
53
fcamelCase = function ( all , letter ) {
@@ -590,10 +591,10 @@ jQuery.extend({
590
591
}
591
592
} ,
592
593
593
- // Converts a dashed string to camelCased string;
594
- // Used by both the css and data modules
594
+ // Convert dashed to camelCase; used by the css and data modules
595
+ // Microsoft forgot to hump their vendor prefix (#9572)
595
596
camelCase : function ( string ) {
596
- return string . replace ( rdashAlpha , fcamelCase ) ;
597
+ return string . replace ( rmsPrefix , "ms-" ) . replace ( rdashAlpha , fcamelCase ) ;
597
598
} ,
598
599
599
600
nodeName : function ( elem , name ) {
Original file line number Diff line number Diff line change @@ -1129,10 +1129,15 @@ test("jQuery.camelCase()", function() {
1129
1129
1130
1130
var tests = {
1131
1131
"foo-bar" : "fooBar" ,
1132
- "foo-bar-baz" : "fooBarBaz"
1132
+ "foo-bar-baz" : "fooBarBaz" ,
1133
+ "girl-u-want" : "girlUWant" ,
1134
+ "the-4th-dimension" : "the4thDimension" ,
1135
+ "-o-tannenbaum" : "OTannenbaum" ,
1136
+ "-moz-illa" : "MozIlla" ,
1137
+ "-ms-take" : "msTake"
1133
1138
} ;
1134
1139
1135
- expect ( 2 ) ;
1140
+ expect ( 7 ) ;
1136
1141
1137
1142
jQuery . each ( tests , function ( key , val ) {
1138
1143
equal ( jQuery . camelCase ( key ) , val , "Converts: " + key + " => " + val ) ;
You can’t perform that action at this time.
0 commit comments