]> source.dussan.org Git - jquery.git/commitdiff
Fix for animating hyphenated CSS properties. Fixes #4156.
authorJohn Resig <jeresig@gmail.com>
Sat, 25 Jul 2009 20:56:15 +0000 (20:56 +0000)
committerJohn Resig <jeresig@gmail.com>
Sat, 25 Jul 2009 20:56:15 +0000 (20:56 +0000)
src/fx.js
test/unit/fx.js

index 8025de4d218f96c2e457f306d33728fc9c945b2e..0596b2b3e7b32e638f59ca93b1e27237a88fd15a 100644 (file)
--- a/src/fx.js
+++ b/src/fx.js
@@ -109,6 +109,14 @@ jQuery.fn.extend({
                                self = this;
 
                        for ( p in prop ) {
+                               var name = p.replace(rdashAlpha, fcamelCase);
+
+                               if ( p !== name ) {
+                                       prop[ name ] = prop[ p ];
+                                       delete prop[ p ];
+                                       p = name;
+                               }
+
                                if ( prop[p] == "hide" && hidden || prop[p] == "show" && !hidden )
                                        return opt.complete.call(this);
 
index 4b7d371c8e674b5e97cc51f68397039474a56439..87e6aea0d5cbdf4c9f3d7baffe9d07b807885efa 100644 (file)
@@ -100,6 +100,18 @@ test("animate duration 0", function() {
        });     
 });
 
+test("animate hyphenated properties", function(){
+       expect(1);
+       stop();
+
+       jQuery("#nothiddendiv")
+               .css("font-size", 10)
+               .animate({"font-size": 20}, 200, function(){
+                       equals( this.style.fontSize, "20px", "The font-size property was animated." );
+                       start();
+               });
+});
+
 test("animate non-element", function(){
        expect(1);
        stop();