Permalink
Browse files

Fixes #12139, make sure absolutely positioned elements have HTML as o…

…ffsetParent, closes gh-1010
  • Loading branch information...
1 parent 18e7a53 commit 8121309694630d3cb29e5b8dc4ad81527a5bb494 David Fox committed with mikesherov Oct 26, 2012
Showing with 6 additions and 1 deletion.
  1. +6 −1 test/unit/offset.js
View
@@ -469,7 +469,7 @@ test("chaining", function() {
});
test("offsetParent", function(){
- expect(12);
+ expect(13);
@rwaldron
rwaldron Oct 26, 2012 Member

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

@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." );
@@ -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() {

0 comments on commit 8121309

Please sign in to comment.