Skip to content

Commit

Permalink
Offset: offsetLeft/Top on empty set returns undefined
Browse files Browse the repository at this point in the history
Fixes gh-2319
Closes gh-2702
Ref gh-2701
  • Loading branch information
dmethvin committed Nov 10, 2015
1 parent 97d79ec commit 2937019
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/offset.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function(
} else {
elem[ method ] = val;
}
}, method, val, arguments.length, null );
}, method, val, arguments.length );
};
} );

Expand Down
4 changes: 2 additions & 2 deletions test/unit/offset.js
Original file line number Diff line number Diff line change
Expand Up @@ -460,8 +460,8 @@ testIframe( "offset/scroll", "scroll", function( $, win, doc, assert ) {
assert.notEqual( $().scrollLeft( 100 ), null, "jQuery().scrollLeft(100) testing setter on empty jquery object" );
assert.notEqual( $().scrollTop( null ), null, "jQuery().scrollTop(null) testing setter on empty jquery object" );
assert.notEqual( $().scrollLeft( null ), null, "jQuery().scrollLeft(null) testing setter on empty jquery object" );
assert.strictEqual( $().scrollTop(), null, "jQuery().scrollTop(100) testing setter on empty jquery object" );
assert.strictEqual( $().scrollLeft(), null, "jQuery().scrollLeft(100) testing setter on empty jquery object" );
assert.strictEqual( $().scrollTop(), undefined, "jQuery().scrollTop() testing getter on empty jquery object" );
assert.strictEqual( $().scrollLeft(), undefined, "jQuery().scrollLeft() testing getter on empty jquery object" );

// Tests position after parent scrolling (#15239)
$( "#scroll-1" ).scrollTop( 0 );
Expand Down

0 comments on commit 2937019

Please sign in to comment.