Skip to content

Commit 586d572

Browse files
committed
Position: Remove fractional pixel detection
Hooray for newer browsers. Closes jquerygh-1739
1 parent 3606e1c commit 586d572

File tree

1 file changed

+1
-28
lines changed

1 file changed

+1
-28
lines changed

ui/position.js

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -27,37 +27,16 @@
2727
}
2828
}( function( $ ) {
2929
( function() {
30-
var cachedScrollbarWidth, supportsOffsetFractions,
30+
var cachedScrollbarWidth,
3131
max = Math.max,
3232
abs = Math.abs,
33-
round = Math.round,
3433
rhorizontal = /left|center|right/,
3534
rvertical = /top|center|bottom/,
3635
roffset = /[\+\-]\d+(\.[\d]+)?%?/,
3736
rposition = /^\w+/,
3837
rpercent = /%$/,
3938
_position = $.fn.position;
4039

41-
// Support: IE <=9 only
42-
supportsOffsetFractions = function() {
43-
var element = $( "<div>" )
44-
.css( "position", "absolute" )
45-
.appendTo( "body" )
46-
.offset( {
47-
top: 1.5,
48-
left: 1.5
49-
} ),
50-
support = element.offset().top === 1.5;
51-
52-
element.remove();
53-
54-
supportsOffsetFractions = function() {
55-
return support;
56-
};
57-
58-
return support;
59-
};
60-
6140
function getOffsets( offsets, width, height ) {
6241
return [
6342
parseFloat( offsets[ 0 ] ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ),
@@ -266,12 +245,6 @@ $.fn.position = function( options ) {
266245
position.left += myOffset[ 0 ];
267246
position.top += myOffset[ 1 ];
268247

269-
// If the browser doesn't support fractions, then round for consistent results
270-
if ( !supportsOffsetFractions() ) {
271-
position.left = round( position.left );
272-
position.top = round( position.top );
273-
}
274-
275248
collisionPosition = {
276249
marginLeft: marginLeft,
277250
marginTop: marginTop

0 commit comments

Comments
 (0)