Skip to content

Commit 2582bfa

Browse files
committed
Position: Removed offset option. Fixes #6982 - Position: Remove offset option.
1 parent bc44e61 commit 2582bfa

File tree

11 files changed

+17
-156
lines changed

11 files changed

+17
-156
lines changed

build/tasks/testswarm.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ var versions = {
2020
"Effects": "effects/effects.html",
2121
"Menu": "menu/menu.html",
2222
"Position": "position/position.html",
23-
"Position_deprecated": "position/position_deprecated.html",
2423
"Progressbar": "progressbar/progressbar.html",
2524
//"resizable/resizable.html",
2625
//"selectable/selectable.html",

demos/position/default.html

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
of: $( "#parent" ),
4949
my: $( "#my_horizontal" ).val() + " " + $( "#my_vertical" ).val(),
5050
at: $( "#at_horizontal" ).val() + " " + $( "#at_vertical" ).val(),
51-
offset: $( "#offset" ).val(),
5251
collision: $( "#collision_horizontal" ).val() + " " + $( "#collision_vertical" ).val()
5352
});
5453
}
@@ -113,10 +112,6 @@
113112
<option value="bottom">bottom</option>
114113
</select>
115114
</div>
116-
<div style="padding-bottom: 20px;">
117-
<b>offset:</b>
118-
<input id="offset">
119-
</div>
120115
<div style="padding-bottom: 20px;">
121116
<b>collision:</b>
122117
<select id="collision_horizontal">

tests/unit/all-active.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
"effects/effects.html",
2828
"menu/menu.html",
2929
"position/position.html",
30-
"position/position_deprecated.html",
3130
"progressbar/progressbar.html",
3231
//"resizable/resizable.html",
3332
//"selectable/selectable.html",

tests/unit/all.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
"effects/effects.html",
2828
"menu/menu.html",
2929
"position/position.html",
30-
"position/position_deprecated.html",
3130
"progressbar/progressbar.html",
3231
//"resizable/resizable.html",
3332
//"selectable/selectable.html",

tests/unit/position/position.html

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55
<title>jQuery UI Position Test Suite</title>
66

77
<script src="../../jquery.js"></script>
8-
<script>
9-
$.uiBackCompat = false;
10-
</script>
118
<link rel="stylesheet" href="../../../external/qunit.css">
129
<script src="../../../external/qunit.js"></script>
1310
<script src="../../jquery.simulate.js"></script>

tests/unit/position/position_deprecated.html

Lines changed: 0 additions & 56 deletions
This file was deleted.

tests/unit/position/position_deprecated.js

Lines changed: 0 additions & 33 deletions
This file was deleted.

tests/unit/subsuite.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ var versions = [
77
"git"
88
],
99
additionalTests = {
10-
position: [ "position_deprecated.html" ]
10+
// component: [ "other_test.html" ]
1111
};
1212

1313
window.testAllVersions = function( widget ) {

tests/visual/position/position_feedback.html

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -55,25 +55,24 @@
5555
});
5656

5757
element.width( 150 );
58-
$( document ).on( "mousemove", function( event ) {
59-
var base = {
58+
function positionWithOffset( horizontal, vertical ) {
59+
return {
6060
my: "left top",
61-
at: "left top",
61+
at: "left" + (horizontal < 0 ? horizontal : "+" + horizontal) + " " +
62+
"top" + (vertical < 0 ? vertical : "+" + vertical),
6263
of: target,
6364
using: using
6465
};
65-
element.position( $.extend({
66-
offset: (event.pageX - targetOffset.left) + " " + (event.pageY - targetOffset.top)
67-
}, base ));
68-
oppositeElement.position( $.extend({
69-
offset: (-1 * (event.pageX - targetOffset.left)) + " " + (-1 * (event.pageY - targetOffset.top))
70-
}, base ));
71-
leftElement.position( $.extend({
72-
offset: (-0.9 * (event.pageX - targetOffset.left)) + " " + (0.9 * (event.pageY - targetOffset.top))
73-
}, base ));
74-
rightElement.position( $.extend({
75-
offset: (0.9 * (event.pageX - targetOffset.left)) + " " + (-0.9 * (event.pageY - targetOffset.top))
76-
}, base) );
66+
};
67+
$( document ).on( "mousemove", function( event ) {
68+
element.position( positionWithOffset(
69+
event.pageX - targetOffset.left, event.pageY - targetOffset.top ) );
70+
oppositeElement.position( positionWithOffset(
71+
-1 * (event.pageX - targetOffset.left), -1 * (event.pageY - targetOffset.top) ) );
72+
leftElement.position( positionWithOffset(
73+
-0.9 * (event.pageX - targetOffset.left), 0.9 * (event.pageY - targetOffset.top) ) );
74+
rightElement.position( positionWithOffset(
75+
0.9 * (event.pageX - targetOffset.left), -0.9 * (event.pageY - targetOffset.top) ) );
7776
});
7877
});
7978
</script>

tests/visual/tooltip/tooltip.html

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@
6666
tooltipClass: "ui-state-highlight",
6767
position: {
6868
my: "center top",
69-
at: "center bottom",
70-
offset: "0 10"
69+
at: "center bottom+10"
7170
}
7271
});
7372

@@ -86,8 +85,7 @@
8685
$( "#buttons" ).tooltip({
8786
position: {
8887
my: "center bottom",
89-
at: "center top",
90-
offset: "0 -5"
88+
at: "center top-5"
9189
}
9290
});
9391

ui/jquery.ui.position.js

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -478,40 +478,4 @@ $.ui.position = {
478478
testElementParent.removeChild( testElement );
479479
})();
480480

481-
// DEPRECATED
482-
if ( $.uiBackCompat !== false ) {
483-
// offset option
484-
(function( $ ) {
485-
var _position = $.fn.position;
486-
$.fn.position = function( options ) {
487-
if ( !options || !options.offset ) {
488-
return _position.call( this, options );
489-
}
490-
var offset = options.offset.split( " " ),
491-
at = options.at.split( " " );
492-
if ( offset.length === 1 ) {
493-
offset[ 1 ] = offset[ 0 ];
494-
}
495-
if ( /^\d/.test( offset[ 0 ] ) ) {
496-
offset[ 0 ] = "+" + offset[ 0 ];
497-
}
498-
if ( /^\d/.test( offset[ 1 ] ) ) {
499-
offset[ 1 ] = "+" + offset[ 1 ];
500-
}
501-
if ( at.length === 1 ) {
502-
if ( /left|center|right/.test( at[ 0 ] ) ) {
503-
at[ 1 ] = "center";
504-
} else {
505-
at[ 1 ] = at[ 0 ];
506-
at[ 0 ] = "center";
507-
}
508-
}
509-
return _position.call( this, $.extend( options, {
510-
at: at[ 0 ] + offset[ 0 ] + " " + at[ 1 ] + offset[ 1 ],
511-
offset: undefined
512-
} ) );
513-
};
514-
}( jQuery ) );
515-
}
516-
517481
}( jQuery ) );

0 commit comments

Comments
 (0)