Commit aaf134bb authored by Nowres Rafid's avatar Nowres Rafid Committed by Dave Methvin

Fix #8482, offsetParent should not return null. Closes gh-847.

parent 05aff402
...@@ -138,7 +138,7 @@ jQuery.fn.extend({ ...@@ -138,7 +138,7 @@ jQuery.fn.extend({
while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) { while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) {
offsetParent = offsetParent.offsetParent; offsetParent = offsetParent.offsetParent;
} }
return offsetParent; return offsetParent || document.body;
}); });
} }
}); });
......
...@@ -305,6 +305,9 @@ Z</textarea> ...@@ -305,6 +305,9 @@ Z</textarea>
<div id="fx-tests"></div> <div id="fx-tests"></div>
</div> </div>
<map name="imgmap" id="imgmap">
<area shape="rect" coords="0,0,200,50">
</map>
</body> </body>
</html> </html>
...@@ -440,7 +440,7 @@ test("chaining", function() { ...@@ -440,7 +440,7 @@ test("chaining", function() {
}); });
test("offsetParent", function(){ test("offsetParent", function(){
expect(11); expect(12);
var body = jQuery("body").offsetParent(); var body = jQuery("body").offsetParent();
equal( body.length, 1, "Only one offsetParent found." ); equal( body.length, 1, "Only one offsetParent found." );
...@@ -464,6 +464,9 @@ test("offsetParent", function(){ ...@@ -464,6 +464,9 @@ test("offsetParent", function(){
equal( div.length, 2, "Two offsetParent found." ); equal( div.length, 2, "Two offsetParent found." );
equal( div[0], document.body, "The body is the offsetParent." ); equal( div[0], document.body, "The body is the offsetParent." );
equal( div[1], jQuery("#nothiddendiv")[0], "The div is the offsetParent." ); 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." );
}); });
test("fractions (see #7730 and #7885)", function() { test("fractions (see #7730 and #7885)", function() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment