diff options
author | Daniel Gálvez <dgalvez@editablething.com> | 2012-08-19 21:53:09 +0200 |
---|---|---|
committer | Dave Methvin <dave.methvin@gmail.com> | 2012-10-24 23:35:15 -0400 |
commit | b398a68333d5eb9859fabb1ceabe84a1a753760a (patch) | |
tree | 22e52195cc6e2c902fc4e1eee3cbbbae182f50af /test/unit | |
parent | 69e2f068fe7d16c1ccd6cb99c6376f0d8891ea33 (diff) | |
download | jquery-b398a68333d5eb9859fabb1ceabe84a1a753760a.tar.gz jquery-b398a68333d5eb9859fabb1ceabe84a1a753760a.zip |
Fix #11542. document.body should not be special in .offset() and document.documentElement is the default element.offsetParent. Close gh-899.
Diffstat (limited to 'test/unit')
-rw-r--r-- | test/unit/offset.js | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/test/unit/offset.js b/test/unit/offset.js index ef98f8417..8bca2d8c1 100644 --- a/test/unit/offset.js +++ b/test/unit/offset.js @@ -452,10 +452,12 @@ testIframe("offset/scroll", "scroll", function( $, win ) { }); testIframe("offset/body", "body", function( $ ) { - expect(2); + expect(4); equal( $("body").offset().top, 1, "jQuery('#body').offset().top" ); equal( $("body").offset().left, 1, "jQuery('#body').offset().left" ); + equal( $("#firstElement").position().left, 5, "$('#firstElement').position().left" ); + equal( $("#firstElement").position().top, 5, "$('#firstElement').position().top" ); }); test("chaining", function() { @@ -471,15 +473,15 @@ test("offsetParent", function(){ var body = jQuery("body").offsetParent(); equal( body.length, 1, "Only one offsetParent found." ); - equal( body[0], document.body, "The body is its own offsetParent." ); + equal( body[0], document.documentElement, "The html element is the offsetParent of the body." ); var header = jQuery("#qunit-header").offsetParent(); equal( header.length, 1, "Only one offsetParent found." ); - equal( header[0], document.body, "The body is the offsetParent." ); + equal( header[0], document.documentElement, "The html element is the offsetParent of the body." ); var div = jQuery("#nothiddendivchild").offsetParent(); equal( div.length, 1, "Only one offsetParent found." ); - equal( div[0], document.body, "The body is the offsetParent." ); + equal( div[0], document.documentElement, "The html element is the offsetParent of the body." ); jQuery("#nothiddendiv").css("position", "relative"); @@ -489,11 +491,11 @@ test("offsetParent", function(){ div = jQuery("body, #nothiddendivchild").offsetParent(); equal( div.length, 2, "Two offsetParent found." ); - equal( div[0], document.body, "The body is the offsetParent." ); + equal( div[0], document.documentElement, "The html element is the offsetParent of the body." ); equal( div[1], jQuery("#nothiddendiv")[0], "The div is the offsetParent." ); var area = jQuery("#imgmap area").offsetParent(); - equal( area[0], document.body, "The body is the offsetParent." ); + equal( area[0], document.documentElement, "The html element is the offsetParent of the body." ); }); test("fractions (see #7730 and #7885)", function() { |