diff options
author | Scott González <scott.gonzalez@gmail.com> | 2016-08-31 12:28:36 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2016-08-31 17:00:19 -0400 |
commit | 586d572ad2667f8f4c974f9e48d8ce7a4519af0c (patch) | |
tree | b4cf689acde3cd16e4c29fac4e764021ec7e9071 | |
parent | 3606e1c33a5838cb6cb55a32de0f11984f84663e (diff) | |
download | jquery-ui-586d572ad2667f8f4c974f9e48d8ce7a4519af0c.tar.gz jquery-ui-586d572ad2667f8f4c974f9e48d8ce7a4519af0c.zip |
Position: Remove fractional pixel detection
Hooray for newer browsers.
Closes gh-1739
-rw-r--r-- | ui/position.js | 29 |
1 files changed, 1 insertions, 28 deletions
diff --git a/ui/position.js b/ui/position.js index 394105667..2f7fa5f01 100644 --- a/ui/position.js +++ b/ui/position.js @@ -27,10 +27,9 @@ } }( function( $ ) { ( function() { -var cachedScrollbarWidth, supportsOffsetFractions, +var cachedScrollbarWidth, max = Math.max, abs = Math.abs, - round = Math.round, rhorizontal = /left|center|right/, rvertical = /top|center|bottom/, roffset = /[\+\-]\d+(\.[\d]+)?%?/, @@ -38,26 +37,6 @@ var cachedScrollbarWidth, supportsOffsetFractions, rpercent = /%$/, _position = $.fn.position; -// Support: IE <=9 only -supportsOffsetFractions = function() { - var element = $( "<div>" ) - .css( "position", "absolute" ) - .appendTo( "body" ) - .offset( { - top: 1.5, - left: 1.5 - } ), - support = element.offset().top === 1.5; - - element.remove(); - - supportsOffsetFractions = function() { - return support; - }; - - return support; -}; - function getOffsets( offsets, width, height ) { return [ parseFloat( offsets[ 0 ] ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ), @@ -266,12 +245,6 @@ $.fn.position = function( options ) { position.left += myOffset[ 0 ]; position.top += myOffset[ 1 ]; - // If the browser doesn't support fractions, then round for consistent results - if ( !supportsOffsetFractions() ) { - position.left = round( position.left ); - position.top = round( position.top ); - } - collisionPosition = { marginLeft: marginLeft, marginTop: marginTop |