Skip to content

Commit

Permalink
Fixes #12139, make sure absolutely positioned elements have HTML as o…
Browse files Browse the repository at this point in the history
…ffsetParent, closes gh-1010
  • Loading branch information
David Fox authored and mikesherov committed Oct 26, 2012
1 parent 18e7a53 commit 8121309
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion test/unit/offset.js
Expand Up @@ -469,7 +469,7 @@ test("chaining", function() {
});

test("offsetParent", function(){
expect(12);
expect(13);

This comment has been minimized.

Copy link
@rwaldron

rwaldron Oct 26, 2012

Member

We should encourage new tests to be in their own call to test( ... )

This comment has been minimized.

Copy link
@mikesherov

mikesherov Oct 26, 2012

Member

Had it that way first, but decided it belonged in the same test block. Next time we won't. Good to know. Thanks!


var body = jQuery("body").offsetParent();
equal( body.length, 1, "Only one offsetParent found." );
Expand All @@ -496,6 +496,11 @@ test("offsetParent", function(){

var area = jQuery("#imgmap area").offsetParent();
equal( area[0], document.documentElement, "The html element is the offsetParent of the body." );

div = jQuery("<div>").css({ "position": "absolute" }).appendTo("body");
equal( div.offsetParent()[0], document.documentElement, "Absolutely positioned div returns html as offset parent, see #12139" );

div.remove();
});

test("fractions (see #7730 and #7885)", function() {
Expand Down

0 comments on commit 8121309

Please sign in to comment.