From: John Resig Date: Sat, 25 Jul 2009 20:56:15 +0000 (+0000) Subject: Fix for animating hyphenated CSS properties. Fixes #4156. X-Git-Url: http://git.asbjorn.it/?a=commitdiff_plain;h=343b0936a43953a993d1f2cc500b954d5bcc8280;hp=fd0bf5d6edec1f3c03008bb29b16d7e7e1b36abc;p=jquery.git Fix for animating hyphenated CSS properties. Fixes #4156. --- diff --git a/src/fx.js b/src/fx.js index 8025de4..0596b2b 100644 --- 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); diff --git a/test/unit/fx.js b/test/unit/fx.js index 4b7d371..87e6aea 100644 --- a/test/unit/fx.js +++ b/test/unit/fx.js @@ -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();