mirror of
https://github.com/jquery/jquery.git
synced 2026-04-20 03:01:22 -04:00
Return null for outer/inner width/height calls on window/document. Fixes #7557.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -7,15 +7,17 @@ jQuery.each([ "Height", "Width" ], function( i, name ) {
|
||||
|
||||
// innerHeight and innerWidth
|
||||
jQuery.fn["inner" + name] = function() {
|
||||
return this[0] ?
|
||||
parseFloat( jQuery.css( this[0], type, "padding" ) ) :
|
||||
var ret;
|
||||
return this[0] && !isNaN( ret = parseFloat(jQuery.css( this[0], type, "padding" )) ) ?
|
||||
ret :
|
||||
null;
|
||||
};
|
||||
|
||||
// outerHeight and outerWidth
|
||||
jQuery.fn["outer" + name] = function( margin ) {
|
||||
return this[0] ?
|
||||
parseFloat( jQuery.css( this[0], type, margin ? "margin" : "border" ) ) :
|
||||
var ret;
|
||||
return this[0] && !isNaN( ret = parseFloat(jQuery.css( this[0], type, margin ? "margin" : "border" )) ) ?
|
||||
ret :
|
||||
null;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user