diff options
author | Dave Methvin <dave.methvin@gmail.com> | 2015-11-09 18:14:59 -0500 |
---|---|---|
committer | Dave Methvin <dave.methvin@gmail.com> | 2015-11-10 10:01:45 -0500 |
commit | 29370190605ed5ddf5d0371c6ad886a4a4b5e0f9 (patch) | |
tree | cbd2fa4a455d1fafd6c05a2166a59da5f031cbbd | |
parent | 97d79ecf6b6c5cc3c1485eb3c46e12986a978f57 (diff) | |
download | jquery-29370190605ed5ddf5d0371c6ad886a4a4b5e0f9.tar.gz jquery-29370190605ed5ddf5d0371c6ad886a4a4b5e0f9.zip |
Offset: offsetLeft/Top on empty set returns undefined
Fixes gh-2319
Closes gh-2702
Ref gh-2701
-rw-r--r-- | src/offset.js | 2 | ||||
-rw-r--r-- | test/unit/offset.js | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/offset.js b/src/offset.js index bef2a8fa0..f7ef79c3c 100644 --- a/src/offset.js +++ b/src/offset.js @@ -202,7 +202,7 @@ jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( } else { elem[ method ] = val; } - }, method, val, arguments.length, null ); + }, method, val, arguments.length ); }; } ); diff --git a/test/unit/offset.js b/test/unit/offset.js index 85f1da65d..a0f253b4e 100644 --- a/test/unit/offset.js +++ b/test/unit/offset.js @@ -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 ); |