Added in .height(fn) and .width(fn) support. Fixes #5915.
[jquery.git] / src / dimensions.js
index 3acbb1d..aeaaa78 100644 (file)
@@ -23,6 +23,13 @@ jQuery.each([ "Height", "Width" ], function( i, name ) {
                if ( !elem ) {
                        return size == null ? null : this;
                }
+               
+               if ( jQuery.isFunction( size ) ) {
+                       return this.each(function( i ) {
+                               var self = jQuery( this );
+                               self[ type ]( size.call( this, i, self[ type ]() ) );
+                       });
+               }
 
                return ("scrollTo" in elem && elem.document) ? // does it walk and quack like a window?
                        // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode