Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions tests/unit/position/position.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
<div id="bug-5280" style="height: 30px; width: 201px;">
<div style="width: 50px; height: 10px;"></div>
</div>

<iframe id="bug-9534" style="position: absolute; top: 0; left: 0; width: 20px; height: 20px;"></iframe>
</div>

</body>
Expand Down
20 changes: 20 additions & 0 deletions tests/unit/position/position_core.js
Original file line number Diff line number Diff line change
Expand Up @@ -719,4 +719,24 @@ test( "bug #5280: consistent results (avoid fractional values)", function() {
deepEqual( offset1, offset2 );
});

test("bug #9534: position in iframe window", function() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be test( "...

expect(1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expect( 1 );

And so on, see http://contribute.jquery.org/style-guide/js/


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 ) );
4 changes: 2 additions & 2 deletions ui/jquery.ui.position.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() }
};
}
Expand Down