Skip to content

Commit c49be0b

Browse files
committed
Merge branch 'master' of github.com:jquery/jquery-ui
2 parents 551fa98 + a0f754f commit c49be0b

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

tests/unit/position/position.html

+4
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,9 @@ <h2 id="qunit-userAgent"></h2>
4343

4444
<div style="position: absolute; height: 5000px; width: 5000px;"></div>
4545

46+
<div id="bug-5280" style="height: 30px; width: 201px;">
47+
<div style="width: 50px; height: 10px;"></div>
48+
</div>
49+
4650
</body>
4751
</html>

tests/unit/position/position_core.js

+18
Original file line numberDiff line numberDiff line change
@@ -330,4 +330,22 @@ test("collision: none, with offset", function() {
330330
}, { top: -13, left: -12 }, "left top, negative offset");
331331
});
332332

333+
//test('bug #5280: consistent results (avoid fractional values)', function() {
334+
// var wrapper = $('#bug-5280'),
335+
// elem = wrapper.children(),
336+
// offset1 = elem.position({
337+
// my: 'center',
338+
// at: 'center',
339+
// of: wrapper,
340+
// collision: 'none'
341+
// }).offset(),
342+
// offset2 = elem.position({
343+
// my: 'center',
344+
// at: 'center',
345+
// of: wrapper,
346+
// collision: 'none'
347+
// }).offset();
348+
// same(offset1, offset2);
349+
//});
350+
333351
})(jQuery);

ui/jquery.ui.position.js

+4
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ $.fn.position = function( options ) {
113113
position.top -= elemHeight / 2;
114114
}
115115

116+
// prevent fractions (see #5280)
117+
position.left = parseInt( position.left );
118+
position.top = parseInt( position.top );
119+
116120
$.each( [ "left", "top" ], function( i, dir ) {
117121
if ( $.ui.position[ collision[i] ] ) {
118122
$.ui.position[ collision[i] ][ dir ]( position, {

0 commit comments

Comments
 (0)