fixed offset(coordinates) returns null when no matching elements in jQuery object (fixes ticket #5888)
This commit is contained in:
parent
a63754aa4e
commit
2c28f229e5
3 changed files with 16 additions and 10 deletions
|
@ -2,16 +2,16 @@ if ( "getBoundingClientRect" in document.documentElement ) {
|
|||
jQuery.fn.offset = function( options ) {
|
||||
var elem = this[0];
|
||||
|
||||
if ( !elem || !elem.ownerDocument ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ( options ) {
|
||||
return this.each(function( i ) {
|
||||
jQuery.offset.setOffset( this, options, i );
|
||||
});
|
||||
}
|
||||
|
||||
if ( !elem || !elem.ownerDocument ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ( elem === elem.ownerDocument.body ) {
|
||||
return jQuery.offset.bodyOffset( elem );
|
||||
}
|
||||
|
@ -28,16 +28,16 @@ if ( "getBoundingClientRect" in document.documentElement ) {
|
|||
jQuery.fn.offset = function( options ) {
|
||||
var elem = this[0];
|
||||
|
||||
if ( !elem || !elem.ownerDocument ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ( options ) {
|
||||
return this.each(function( i ) {
|
||||
jQuery.offset.setOffset( this, options, i );
|
||||
});
|
||||
}
|
||||
|
||||
if ( !elem || !elem.ownerDocument ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ( elem === elem.ownerDocument.body ) {
|
||||
return jQuery.offset.bodyOffset( elem );
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue