]> source.dussan.org Git - jquery.git/commitdiff
Landing pull request 463. Fixes #9572. Don't camelize the `-ms-` prefix because Micro...
authordmethvin <dave.methvin@gmail.com>
Wed, 17 Aug 2011 21:30:31 +0000 (17:30 -0400)
committertimmywil <timmywillisn@gmail.com>
Wed, 17 Aug 2011 21:34:09 +0000 (17:34 -0400)
More Details:
 - https://github.com/jquery/jquery/pull/463
 - http://bugs.jquery.com/ticket/9572

src/core.js
test/unit/core.js

index 7a77ae13270a2ee1a3ac3a0a597c821f013a26be..694f884d68d7a0f1db9b69c699e1f6aed7769297 100644 (file)
@@ -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 ) {
index 8c285f6dd89411ad539e8b3efde45b2392a09449..d47920501118c0d4175f3fbe587e65b0794c9244 100644 (file)
@@ -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 );