Add support for calling outer/inner Width/Height on the window and document. Fixes #9434.

This commit is contained in:
timmywil
2011-09-30 17:50:07 -04:00
parent 96a44a86d8
commit 1ebced1736
2 changed files with 35 additions and 18 deletions

View File

@@ -8,16 +8,20 @@ jQuery.each([ "Height", "Width" ], function( i, name ) {
// innerHeight and innerWidth
jQuery.fn[ "inner" + name ] = function() {
var elem = this[0];
return elem && elem.style ?
return elem ?
elem.style ?
parseFloat( jQuery.css( elem, type, "padding" ) ) :
this[ type ]() :
null;
};
// outerHeight and outerWidth
jQuery.fn[ "outer" + name ] = function( margin ) {
var elem = this[0];
return elem && elem.style ?
return elem ?
elem.style ?
parseFloat( jQuery.css( elem, type, margin ? "margin" : "border" ) ) :
this[ type ]() :
null;
};