mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Position: Remove fractional pixel detection
Hooray for newer browsers. Closes gh-1739
This commit is contained in:
parent
3606e1c33a
commit
586d572ad2
@ -27,10 +27,9 @@
|
|||||||
}
|
}
|
||||||
}( function( $ ) {
|
}( function( $ ) {
|
||||||
( function() {
|
( function() {
|
||||||
var cachedScrollbarWidth, supportsOffsetFractions,
|
var cachedScrollbarWidth,
|
||||||
max = Math.max,
|
max = Math.max,
|
||||||
abs = Math.abs,
|
abs = Math.abs,
|
||||||
round = Math.round,
|
|
||||||
rhorizontal = /left|center|right/,
|
rhorizontal = /left|center|right/,
|
||||||
rvertical = /top|center|bottom/,
|
rvertical = /top|center|bottom/,
|
||||||
roffset = /[\+\-]\d+(\.[\d]+)?%?/,
|
roffset = /[\+\-]\d+(\.[\d]+)?%?/,
|
||||||
@ -38,26 +37,6 @@ var cachedScrollbarWidth, supportsOffsetFractions,
|
|||||||
rpercent = /%$/,
|
rpercent = /%$/,
|
||||||
_position = $.fn.position;
|
_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 ) {
|
function getOffsets( offsets, width, height ) {
|
||||||
return [
|
return [
|
||||||
parseFloat( offsets[ 0 ] ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ),
|
parseFloat( offsets[ 0 ] ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ),
|
||||||
@ -266,12 +245,6 @@ $.fn.position = function( options ) {
|
|||||||
position.left += myOffset[ 0 ];
|
position.left += myOffset[ 0 ];
|
||||||
position.top += myOffset[ 1 ];
|
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 = {
|
collisionPosition = {
|
||||||
marginLeft: marginLeft,
|
marginLeft: marginLeft,
|
||||||
marginTop: marginTop
|
marginTop: marginTop
|
||||||
|
Loading…
Reference in New Issue
Block a user