Skip to content

Commit

Permalink
Position: Removed offset option. Fixes #6982 - Position: Remove offse…
Browse files Browse the repository at this point in the history
…t option.
  • Loading branch information
scottgonzalez committed Oct 25, 2012
1 parent bc44e61 commit 2582bfa
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 156 deletions.
1 change: 0 additions & 1 deletion build/tasks/testswarm.js
Expand Up @@ -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",
Expand Down
5 changes: 0 additions & 5 deletions demos/position/default.html
Expand Up @@ -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()
});
}
Expand Down Expand Up @@ -113,10 +112,6 @@
<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">
Expand Down
1 change: 0 additions & 1 deletion tests/unit/all-active.html
Expand Up @@ -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",
Expand Down
1 change: 0 additions & 1 deletion tests/unit/all.html
Expand Up @@ -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",
Expand Down
3 changes: 0 additions & 3 deletions tests/unit/position/position.html
Expand Up @@ -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>
Expand Down
56 changes: 0 additions & 56 deletions tests/unit/position/position_deprecated.html

This file was deleted.

33 changes: 0 additions & 33 deletions tests/unit/position/position_deprecated.js

This file was deleted.

2 changes: 1 addition & 1 deletion tests/unit/subsuite.js
Expand Up @@ -7,7 +7,7 @@ var versions = [
"git"
],
additionalTests = {
position: [ "position_deprecated.html" ]
// component: [ "other_test.html" ]
};

window.testAllVersions = function( widget ) {
Expand Down
29 changes: 14 additions & 15 deletions tests/visual/position/position_feedback.html
Expand Up @@ -55,25 +55,24 @@
});

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>
Expand Down
6 changes: 2 additions & 4 deletions tests/visual/tooltip/tooltip.html
Expand Up @@ -66,8 +66,7 @@
tooltipClass: "ui-state-highlight",
position: {
my: "center top",
at: "center bottom",
offset: "0 10"
at: "center bottom+10"
}
});

Expand All @@ -86,8 +85,7 @@
$( "#buttons" ).tooltip({
position: {
my: "center bottom",
at: "center top",
offset: "0 -5"
at: "center top-5"
}
});

Expand Down
36 changes: 0 additions & 36 deletions ui/jquery.ui.position.js
Expand Up @@ -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 ) );

0 comments on commit 2582bfa

Please sign in to comment.