diff --git a/tests/unit/position/position.html b/tests/unit/position/position.html index f3b1ad86ca8..041f47b99c3 100644 --- a/tests/unit/position/position.html +++ b/tests/unit/position/position.html @@ -47,6 +47,8 @@
+ + diff --git a/tests/unit/position/position_core.js b/tests/unit/position/position_core.js index e03d4c11152..b8a2e7eeae6 100644 --- a/tests/unit/position/position_core.js +++ b/tests/unit/position/position_core.js @@ -719,4 +719,24 @@ test( "bug #5280: consistent results (avoid fractional values)", function() { deepEqual( offset1, offset2 ); }); +test("bug #9534: position in iframe window", function() { + expect(1); + + var iframe = $("#bug-9534")[0]; + + $(iframe.contentDocument.body).css({ + "width" : "30px", + "height" : "30px" + }); + + collisionTest({ + my : "center", + at : "center", + of : iframe.contentWindow + }, { + top : 5, + left : 5 + }, "positioned to iframe window"); +}); + }( jQuery ) ); diff --git a/ui/jquery.ui.position.js b/ui/jquery.ui.position.js index 21c3cef1b19..56aa642b4af 100644 --- a/ui/jquery.ui.position.js +++ b/ui/jquery.ui.position.js @@ -45,8 +45,8 @@ function getDimensions( elem ) { } if ( $.isWindow( raw ) ) { return { - width: elem.width(), - height: elem.height(), + width: (typeof raw.innerWidth === "number") ? raw.innerWidth : elem.width(), + height: (typeof raw.innerHeight === "number") ? raw.innerHeight : elem.height(), offset: { top: elem.scrollTop(), left: elem.scrollLeft() } }; }