Merge "[FileRepo] Fixed file move data-loss race condition."
[lhc/web/wiklou.git] / resources / jquery.ui / jquery.ui.position.js
index b66e59e..1989896 100644 (file)
@@ -1,7 +1,7 @@
-/*
- * jQuery UI Position 1.8.11
+/*!
+ * jQuery UI Position 1.8.20
  *
- * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
+ * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
  * Dual licensed under the MIT or GPL Version 2 licenses.
  * http://jquery.org/license
  *
@@ -14,6 +14,7 @@ $.ui = $.ui || {};
 var horizontalPositions = /left|center|right/,
        verticalPositions = /top|center|bottom/,
        center = "center",
+       support = {},
        _position = $.fn.position,
        _offset = $.fn.offset;
 
@@ -121,9 +122,11 @@ $.fn.position = function( options ) {
                        position.top -= elemHeight / 2;
                }
 
-               // prevent fractions (see #5280)
-               position.left = Math.round( position.left );
-               position.top = Math.round( position.top );
+               // prevent fractions if jQuery version doesn't support them (see #5280)
+               if ( !support.fractions ) {
+                       position.left = Math.round( position.left );
+                       position.top = Math.round( position.top );
+               }
 
                collisionPosition = {
                        left: position.left - marginLeft,
@@ -249,4 +252,47 @@ if ( !$.offset.setOffset ) {
        };
 }
 
+// fraction support test (older versions of jQuery don't support fractions)
+(function () {
+       var body = document.getElementsByTagName( "body" )[ 0 ], 
+               div = document.createElement( "div" ),
+               testElement, testElementParent, testElementStyle, offset, offsetTotal;
+
+       //Create a "fake body" for testing based on method used in jQuery.support
+       testElement = document.createElement( body ? "div" : "body" );
+       testElementStyle = {
+               visibility: "hidden",
+               width: 0,
+               height: 0,
+               border: 0,
+               margin: 0,
+               background: "none"
+       };
+       if ( body ) {
+               $.extend( testElementStyle, {
+                       position: "absolute",
+                       left: "-1000px",
+                       top: "-1000px"
+               });
+       }
+       for ( var i in testElementStyle ) {
+               testElement.style[ i ] = testElementStyle[ i ];
+       }
+       testElement.appendChild( div );
+       testElementParent = body || document.documentElement;
+       testElementParent.insertBefore( testElement, testElementParent.firstChild );
+
+       div.style.cssText = "position: absolute; left: 10.7432222px; top: 10.432325px; height: 30px; width: 201px;";
+
+       offset = $( div ).offset( function( _, offset ) {
+               return offset;
+       }).offset();
+
+       testElement.innerHTML = "";
+       testElementParent.removeChild( testElement );
+
+       offsetTotal = offset.top + offset.left + ( body ? 2000 : 0 );
+       support.fractions = offsetTotal > 21 && offsetTotal < 22;
+})();
+
 }( jQuery ));