]> source.dussan.org Git - jquery-ui.git/commitdiff
Position: Removed offset option. Fixes #6982 - Position: Remove offset option.
authorScott González <scott.gonzalez@gmail.com>
Thu, 25 Oct 2012 10:39:14 +0000 (06:39 -0400)
committerScott González <scott.gonzalez@gmail.com>
Thu, 25 Oct 2012 10:39:14 +0000 (06:39 -0400)
build/tasks/testswarm.js
demos/position/default.html
tests/unit/all-active.html
tests/unit/all.html
tests/unit/position/position.html
tests/unit/position/position_deprecated.html [deleted file]
tests/unit/position/position_deprecated.js [deleted file]
tests/unit/subsuite.js
tests/visual/position/position_feedback.html
tests/visual/tooltip/tooltip.html
ui/jquery.ui.position.js

index 96e33b0f4c62890375e6c7cc9a3c0fc9c2c5a63d..21b644a52288b0ce092c500ae49d014391638b01 100644 (file)
@@ -20,7 +20,6 @@ var versions = {
                "Effects": "effects/effects.html",
                "Menu": "menu/menu.html",
                "Position": "position/position.html",
-               "Position_deprecated": "position/position_deprecated.html",
                "Progressbar": "progressbar/progressbar.html",
                //"resizable/resizable.html",
                //"selectable/selectable.html",
index 223788b1fba682451bcd1726153645b9de178923..48fd07e35fd887cdc2b93d7b790f9c4f852e3d74 100644 (file)
@@ -48,7 +48,6 @@
                                of: $( "#parent" ),
                                my: $( "#my_horizontal" ).val() + " " + $( "#my_vertical" ).val(),
                                at: $( "#at_horizontal" ).val() + " " + $( "#at_vertical" ).val(),
-                               offset: $( "#offset" ).val(),
                                collision: $( "#collision_horizontal" ).val() + " " + $( "#collision_vertical" ).val()
                        });
                }
                        <option value="bottom">bottom</option>
                </select>
        </div>
-       <div style="padding-bottom: 20px;">
-               <b>offset:</b>
-               <input id="offset">
-       </div>
        <div style="padding-bottom: 20px;">
                <b>collision:</b>
                <select id="collision_horizontal">
index 2364114755ffe6990ac73fda0136129e0a46ee37..fe3e05682ab48fb59fa7c47769e265617a1bc367 100644 (file)
@@ -27,7 +27,6 @@
                        "effects/effects.html",
                        "menu/menu.html",
                        "position/position.html",
-                       "position/position_deprecated.html",
                        "progressbar/progressbar.html",
                        //"resizable/resizable.html",
                        //"selectable/selectable.html",
index e8dac887c2c07ceeae2cb7d0547bea84723e379a..f3e5b33c16c46778211ab64f06f18c82fe3f17ad 100644 (file)
@@ -27,7 +27,6 @@
                        "effects/effects.html",
                        "menu/menu.html",
                        "position/position.html",
-                       "position/position_deprecated.html",
                        "progressbar/progressbar.html",
                        //"resizable/resizable.html",
                        //"selectable/selectable.html",
index 8738ae6675cdefb4d1f2f33c126cd9508d56d8d4..f3b1ad86ca82c4063b8919fe23c7fea5708f4faa 100644 (file)
@@ -5,9 +5,6 @@
        <title>jQuery UI Position Test Suite</title>
 
        <script src="../../jquery.js"></script>
-       <script>
-       $.uiBackCompat = false;
-       </script>
        <link rel="stylesheet" href="../../../external/qunit.css">
        <script src="../../../external/qunit.js"></script>
        <script src="../../jquery.simulate.js"></script>
diff --git a/tests/unit/position/position_deprecated.html b/tests/unit/position/position_deprecated.html
deleted file mode 100644 (file)
index 84aae61..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-<!doctype html>
-<html lang="en">
-<head>
-       <meta charset="utf-8">
-       <title>jQuery UI Position Test Suite</title>
-
-       <script src="../../jquery.js"></script>
-
-
-
-       <link rel="stylesheet" href="../../../external/qunit.css">
-       <script src="../../../external/qunit.js"></script>
-       <script src="../../jquery.simulate.js"></script>
-       <script src="../testsuite.js"></script>
-       <script>
-       TestHelpers.loadResources({
-               js: [ "ui/jquery.ui.position.js" ]
-       });
-       </script>
-
-       <script src="position_core.js"></script>
-       <script src="position_deprecated.js"></script>
-       <script src="../swarminject.js"></script>
-</head>
-<body>
-<div id="qunit" style="position:relative; z-index:2;"></div>
-
-<!--
-elements smaller than 20px have a line-height set on them to avoid a bug in IE6
-.height() returns the greater of the height and line-height
--->
-
-<div id="qunit-fixture" style="top: 0; left: 0; z-index:1">
-       <div id="el1" style="position: absolute; width: 6px; height: 6px; line-height: 6px;"></div>
-       <div id="el2" style="position: absolute; width: 6px; height: 6px; line-height: 6px;"></div>
-       <div id="parent" style="position: absolute; width: 6px; height: 6px; top: 4px; left: 4px; line-height: 6px;"></div>
-       <div id="within" style="position: absolute; width: 12px; height: 12px; top: 2px; left: 0px; line-height: 12px;"></div>
-
-       <div id="scrollx" style="position: absolute; top: 0px; left: 0px">
-               <div id="elx" style="position: absolute; width: 10px; height: 10px; line-height: 10px;"></div>
-               <div id="parentx" style="position: absolute; width: 20px; height: 20px; top: 40px; left: 40px;"></div>
-       </div>
-
-       <div style="position: absolute; height: 5000px; width: 5000px;"></div>
-
-       <div id="fractions-parent" style="position: absolute; left: 10.7432222px; top: 10.532325px; height: 30px; width: 201px;">
-               <div id="fractions-element"></div>
-       </div>
-
-       <div id="bug-5280" style="height: 30px; width: 201px;">
-               <div style="width: 50px; height: 10px;"></div>
-       </div>
-</div>
-
-</body>
-</html>
diff --git a/tests/unit/position/position_deprecated.js b/tests/unit/position/position_deprecated.js
deleted file mode 100644 (file)
index 789d4e6..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-(function( $ ) {
-
-test( "offset", function() {
-       expect( 3 );
-       $( "#elx" ).position({
-               my: "left top",
-               at: "left bottom",
-               of: "#parentx",
-               offset: "10",
-               collision: "none"
-       });
-       deepEqual( $( "#elx" ).offset(), { top: 70, left: 50 }, "single value" );
-
-       $( "#elx" ).position({
-               my: "left top",
-               at: "left bottom",
-               of: "#parentx",
-               offset: "5 -3",
-               collision: "none"
-       });
-       deepEqual( $( "#elx" ).offset(), { top: 57, left: 45 }, "two values" );
-
-       $( "#elx" ).position({
-               my: "left top",
-               at: "left bottom",
-               of: "#parentx",
-               offset: "5px -3px",
-               collision: "none"
-       });
-       deepEqual( $( "#elx" ).offset(), { top: 57, left: 45 }, "with units" );
-});
-
-}( jQuery ) );
index b583bbd7597f23d48b1354b0ad578a88de1a8bf5..148f35b1ea485d702926a6e17fdee5f558256a8c 100644 (file)
@@ -7,7 +7,7 @@ var versions = [
                "git"
        ],
        additionalTests = {
-               position: [ "position_deprecated.html" ]
+               // component: [ "other_test.html" ]
        };
 
 window.testAllVersions = function( widget ) {
index fe1f04e5b0a6089a91073f598373232585dac39c..fb3bf00fd6ea3f0848b2800017b9b786e471788a 100644 (file)
                });
 
                element.width( 150 );
-               $( document ).on( "mousemove", function( event ) {
-                       var base = {
+               function positionWithOffset( horizontal, vertical ) {
+                       return {
                                my: "left top",
-                               at: "left top",
+                               at: "left" + (horizontal < 0 ? horizontal : "+" + horizontal) + " " +
+                                       "top" + (vertical < 0 ? vertical : "+" + vertical),
                                of: target,
                                using: using
                        };
-                       element.position( $.extend({
-                               offset: (event.pageX - targetOffset.left) + " " + (event.pageY - targetOffset.top)
-                       }, base ));
-                       oppositeElement.position( $.extend({
-                               offset: (-1 * (event.pageX - targetOffset.left)) + " " + (-1 * (event.pageY - targetOffset.top))
-                       }, base ));
-                       leftElement.position( $.extend({
-                               offset: (-0.9 * (event.pageX - targetOffset.left)) + " " + (0.9 * (event.pageY - targetOffset.top))
-                       }, base ));
-                       rightElement.position( $.extend({
-                               offset: (0.9 * (event.pageX - targetOffset.left)) + " " + (-0.9 * (event.pageY - targetOffset.top))
-                       }, base) );
+               };
+               $( document ).on( "mousemove", function( event ) {
+                       element.position( positionWithOffset(
+                               event.pageX - targetOffset.left, event.pageY - targetOffset.top ) );
+                       oppositeElement.position( positionWithOffset(
+                               -1 * (event.pageX - targetOffset.left), -1 * (event.pageY - targetOffset.top) ) );
+                       leftElement.position( positionWithOffset(
+                               -0.9 * (event.pageX - targetOffset.left), 0.9 * (event.pageY - targetOffset.top) ) );
+                       rightElement.position( positionWithOffset(
+                               0.9 * (event.pageX - targetOffset.left), -0.9 * (event.pageY - targetOffset.top) ) );
                });
        });
        </script>
index 598af0ee850b69d7f485bf67a63f51646aa535c3..706ed509139dec86918d4a4d5de5944db0cb75be 100644 (file)
@@ -66,8 +66,7 @@
                        tooltipClass: "ui-state-highlight",
                        position: {
                                my: "center top",
-                               at: "center bottom",
-                               offset: "0 10"
+                               at: "center bottom+10"
                        }
                });
 
@@ -86,8 +85,7 @@
                $( "#buttons" ).tooltip({
                        position: {
                                my: "center bottom",
-                               at: "center top",
-                               offset: "0 -5"
+                               at: "center top-5"
                        }
                });
 
index 5b595a8c0d9719770aeeb62f7991345854b76906..edbb0f6ff87b36660bbc7413ec64872bb7305b49 100644 (file)
@@ -478,40 +478,4 @@ $.ui.position = {
        testElementParent.removeChild( testElement );
 })();
 
-// DEPRECATED
-if ( $.uiBackCompat !== false ) {
-       // offset option
-       (function( $ ) {
-               var _position = $.fn.position;
-               $.fn.position = function( options ) {
-                       if ( !options || !options.offset ) {
-                               return _position.call( this, options );
-                       }
-                       var offset = options.offset.split( " " ),
-                               at = options.at.split( " " );
-                       if ( offset.length === 1 ) {
-                               offset[ 1 ] = offset[ 0 ];
-                       }
-                       if ( /^\d/.test( offset[ 0 ] ) ) {
-                               offset[ 0 ] = "+" + offset[ 0 ];
-                       }
-                       if ( /^\d/.test( offset[ 1 ] ) ) {
-                               offset[ 1 ] = "+" + offset[ 1 ];
-                       }
-                       if ( at.length === 1 ) {
-                               if ( /left|center|right/.test( at[ 0 ] ) ) {
-                                       at[ 1 ] = "center";
-                               } else {
-                                       at[ 1 ] = at[ 0 ];
-                                       at[ 0 ] = "center";
-                               }
-                       }
-                       return _position.call( this, $.extend( options, {
-                               at: at[ 0 ] + offset[ 0 ] + " " + at[ 1 ] + offset[ 1 ],
-                               offset: undefined
-                       } ) );
-               };
-       }( jQuery ) );
-}
-
 }( jQuery ) );