Return null for outer/inner width/height calls on window/document. Fixes #7557.

This commit is contained in:
timmywil 2011-05-25 19:49:50 -04:00
parent 1d1cb582c0
commit edb2286544
3 changed files with 37 additions and 9 deletions

View file

@ -170,6 +170,11 @@ jQuery.each(["height", "width"], function( i, name ) {
get: function( elem, computed, extra ) {
var val;
// Tests for window/document
if ( !elem.style ) {
return null;
}
if ( computed ) {
if ( elem.offsetWidth !== 0 ) {
val = getWH( elem, name, extra );
@ -196,7 +201,6 @@ jQuery.each(["height", "width"], function( i, name ) {
if ( val < 0 || val == null ) {
val = elem.style[ name ];
// Should return "auto" instead of 0, use 0 for
// temporary backwards-compat
return val === "" || val === "auto" ? "0px" : val;