From 4ab5a88bc4cd76c293190ed68a4962d91c108816 Mon Sep 17 00:00:00 2001 From: John Resig Date: Sun, 9 Apr 2006 04:03:36 +0000 Subject: [PATCH] $().css("foo") now returns the value of $.css("foo") instead of setting to null. --- jquery/jquery.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/jquery/jquery.js b/jquery/jquery.js index 66588f51d..668a592d5 100644 --- a/jquery/jquery.js +++ b/jquery/jquery.js @@ -67,13 +67,14 @@ function $(a,c) { }, css: function(a,b) { - return this.each(function(){ - if ( !b ) - for ( var j in a ) - $.attr(this.style,j,a[j]); - else - $.attr(this.style,a,b); - }); + return a.constructor != String || b ? + this.each(function(){ + if ( !b ) + for ( var j in a ) + $.attr(this.style,j,a[j]); + else + $.attr(this.style,a,b); + }) : $.css( this.get(0), a ); }, toggle: function() { return this.each(function(){ -- 2.39.5