Make sure that calling .width(num) or .height(num) on an empty set returns the empty set. Fixes #5600.
This commit is contained in:
parent
715d1c5a30
commit
a5f8a14411
2 changed files with 13 additions and 4 deletions
|
@ -20,7 +20,10 @@ jQuery.each([ "Height", "Width" ], function(i, name){
|
|||
jQuery.fn[ type ] = function( size ) {
|
||||
// Get window width or height
|
||||
var elem = this[0];
|
||||
if ( !elem ) { return null; }
|
||||
if ( !elem ) {
|
||||
return size == null ? null : this;
|
||||
}
|
||||
|
||||
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
|
||||
elem.document.compatMode === "CSS1Compat" && elem.document.documentElement[ "client" + name ] ||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue