]> source.dussan.org Git - jquery.git/commitdiff
Fixes #12139, make sure absolutely positioned elements have HTML as offsetParent...
authorDavid Fox <dfox@snap-interactive.com>
Fri, 26 Oct 2012 16:38:05 +0000 (12:38 -0400)
committerMike Sherov <mike.sherov@gmail.com>
Fri, 26 Oct 2012 16:40:57 +0000 (12:40 -0400)
test/unit/offset.js

index 8bca2d8c12c0c269dabb0c2b97a2c85320906aab..ac1cc0cbfa9d25d5cbb1585a534db2c60f66e39f 100644 (file)
@@ -469,7 +469,7 @@ test("chaining", function() {
 });
 
 test("offsetParent", function(){
-       expect(12);
+       expect(13);
 
        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() {