Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Landing a version of $(document)/$(window) .width()/.height(). It won…

…'t win any awards, but it'll hold us over for this release.
  • Loading branch information...
commit 139b03af7c2d7e70a26591424f82f09a02132198 1 parent 052aa14
@jeresig jeresig authored
Showing with 14 additions and 4 deletions.
  1. +14 −4 src/core.js
View
18 src/core.js
@@ -1080,10 +1080,20 @@ jQuery.each( {
};
});
-jQuery.each( [ "height", "width" ], function(i,n){
+jQuery.each( [ "Height", "Width" ], function(i,name){
+ var n = name.toLowerCase();
+
jQuery.fn[ n ] = function(h) {
- return h == undefined ?
- ( this.length ? jQuery.css( this[0], n ) : null ) :
- this.css( n, h.constructor == String ? h : h + "px" );
+ return this[0] == window ?
+ jQuery.browser.safari && self["inner" + name] ||
+ jQuery.boxModel && Math.max(document.documentElement["client" + name], document.body["client" + name]) ||
+ document.body["client" + name] :
+
+ this[0] == document ?
+ Math.max( document.body["scroll" + name], document.body["offset" + name] ) :
+
+ h == undefined ?
+ ( this.length ? jQuery.css( this[0], n ) : null ) :
+ this.css( n, h.constructor == String ? h : h + "px" );
};
});
Please sign in to comment.
Something went wrong with that request. Please try again.