r2902 - positionTo: Renamed to position.
Author: scott.gonzalez
Date: Thu Jul 9 06:12:46 2009
New Revision: 2902
Modified:
branches/dev/positionTo/demos/index.html
branches/dev/positionTo/demos/positionTo/cycler.html
branches/dev/positionTo/demos/positionTo/default.html
branches/dev/positionTo/demos/positionTo/index.html
branches/dev/positionTo/tests/unit/positionTo/positionTo.html
branches/dev/positionTo/tests/unit/positionTo/positionTo_core.js
branches/dev/positionTo/ui/ui.positionTo.js
Log:
positionTo: Renamed to position.
Modified: branches/dev/positionTo/demos/index.html
==============================================================================
--- branches/dev/positionTo/demos/index.html (original)
+++ branches/dev/positionTo/demos/index.html Thu Jul 9 06:12:46 2009
@@ -264,7 +264,7 @@
<dd><a href="animate/index.html">Animate</a></dd>
<dd><a href="effect/index.html">Effect</a></dd>
<dt>Utilities</dt>
- <dd><a href="positionTo/index.html">Position
To</a></dd>
+ <dd><a href="positionTo/index.html">Position</a></dd>
<dt>About jQuery UI</dt>
<dd><a href="http://jqueryui.com/docs/Getting_Started">Getting
Started</a></dd>
<dd><a href="http://jqueryui.com/docs/Upgrade_Guide">Upgrade
Guide</a></dd>
Modified: branches/dev/positionTo/demos/positionTo/cycler.html
==============================================================================
--- branches/dev/positionTo/demos/positionTo/cycler.html (original)
+++ branches/dev/positionTo/demos/positionTo/cycler.html Thu Jul 9
06:12:46 2009
@@ -1,7 +1,7 @@
<!doctype html>
<html lang="en">
<head>
- <title>jQuery UI PositionTo - Default functionality</title>
+ <title>jQuery UI Position - Default functionality</title>
<link type="text/css" href="../../themes/base/ui.all.css"
rel="stylesheet" />
<script type="text/javascript" src="../../jquery-1.3.2.js"></script>
<script type="text/javascript" src="../../ui/ui.core.js"></script>
@@ -19,8 +19,8 @@
<script type="text/javascript">
$(function() {
- $.fn.positionTo2 = function(options) {
- return this.positionTo($.extend({
+ $.fn.position2 = function(options) {
+ return this.position($.extend({
of: window,
by: function(to) {
$(this).css({
@@ -33,7 +33,7 @@
}
$.fn.left = function(by) {
- return this.positionTo2({
+ return this.position2({
my: "right middle",
at: "left middle",
offset: "25 0",
@@ -41,7 +41,7 @@
});
}
$.fn.right = function(by) {
- return this.positionTo2({
+ return this.position2({
my: "left middle",
at: "right middle",
offset: "-25 0",
@@ -49,7 +49,7 @@
});
}
$.fn.center = function(by) {
- return this.positionTo2({
+ return this.position2({
my: "center middle",
at: "center middle",
by: by
@@ -113,7 +113,7 @@
<div class="demo-description">
-A prototype for the <a
href="http://wiki.jqueryui.com/Photoviewer">Photoviewer</a> using
PositionTo to place images at the center, left and right and cycle them.
+
A prototype for the <a
href="http://wiki.jqueryui.com/Photoviewer">Photoviewer</a> using Position
to place images at the center, left and right and cycle them.
<br/>Use the links at the top to cycle, or click on the images on the left
and right.
<br/>Note how the images are repositioned when resizing the window.
<br/>Warning: Doesn't currently work inside the demo viewer; open in a new
window instead!
Modified: branches/dev/positionTo/demos/positionTo/default.html
==============================================================================
--- branches/dev/positionTo/demos/positionTo/default.html (original)
+++ branches/dev/positionTo/demos/positionTo/default.html Thu Jul 9
06:12:46 2009
@@ -1,7 +1,7 @@
<!doctype html>
<html lang="en">
<head>
- <title>jQuery UI PositionTo - Default functionality</title>
+ <title>jQuery UI Position - Default functionality</title>
<link type="text/css" href="../../themes/base/ui.all.css"
rel="stylesheet" />
<script type="text/javascript" src="../../jquery-1.3.2.js"></script>
<script type="text/javascript" src="../../ui/ui.core.js"></script>
@@ -44,7 +44,7 @@
$(function() {
function position(by) {
- $('.positionable').positionTo({
+ $('.positionable').position({
of: $('#parent'),
my: $('#my_horizontal').val() + ' ' +
$('#my_vertical').val(),
at: $('#at_horizontal').val() + ' '+
$('#at_vertical').val(),
@@ -84,7 +84,7 @@
<div id="parent">
- This is the positionTo parent element.
+ This is the position parent element.
</div>
Modified: branches/dev/positionTo/demos/positionTo/index.html
==============================================================================
--- branches/dev/positionTo/demos/positionTo/index.html (original)
+++ branches/dev/positionTo/demos/positionTo/index.html Thu Jul 9 06:12:46
2009
@@ -1,7 +1,7 @@
<!doctype html>
<html lang="en">
<head>
- <title>jQuery UI PositionTo Demo</title>
+ <title>jQuery UI Position Demo</title>
<link type="text/css" href="../demos.css" rel="stylesheet" />
</head>
<body>
Modified: branches/dev/positionTo/tests/unit/positionTo/positionTo.html
==============================================================================
--- branches/dev/positionTo/tests/unit/positionTo/positionTo.html (original)
+++ branches/dev/positionTo/tests/unit/positionTo/positionTo.html Thu Jul
9 06:12:46 2009
@@ -1,7 +1,7 @@
<!doctype html>
<html lang="en">
<head>
- <title>jQuery UI PositionTo Test Suite</title>
+ <title>jQuery UI Position Test Suite</title>
<script type="text/javascript" src="../../../jquery-1.3.2.js"></script>
<script type="text/javascript" src="../../../ui/ui.core.js"></script>
@@ -22,8 +22,16 @@
</div>
<div style="position: absolute; top: 0px; left: 0px">
- <div id="elx" style="position: absolute; width: 10px; height: 10px;
background-color: red"></div>
- <div id="parentx" style="position: absolute; width: 20px; height: 20px;
top: 40px; left: 40px; background-color: green"></div>
+ <div id="elx" style="position: absolute; width: 10px; height:
10px;"></div>
+ <div id="parentx" style="position: absolute; width: 20px; height: 20px;
top: 40px; left: 40px;"></div>
+</div>
+
+<div style="position: absolute; top: 200px; left: 100px;">
+ <div id="el-offset-100-200" style="position: absolute; width: 10px;
height: 10px;"></div>
+ <div style="position: absolute; top: 100px; left: 50px;">
+ <div id="el-two-offset-150-300" style="position: absolute; width: 10px;
height: 10px;"></div>
+ <div id="el-fixed" style="position: fixed; top: 200px; left:
200px;"></div>
+ </div>
</div>
<div style="position: absolute; height: 5000px; width: 5000px;"></div>
Modified: branches/dev/positionTo/tests/unit/positionTo/positionTo_core.js
==============================================================================
--- branches/dev/positionTo/tests/unit/positionTo/positionTo_core.js
(original)
+++ branches/dev/positionTo/tests/unit/positionTo/positionTo_core.js Thu
Jul 9 06:12:46 2009
@@ -1,10 +1,10 @@
/*
- * positionTo_core.js
+ * position_core.js
*/
(function($) {
test('my, at, of', function() {
- $('#elx').positionTo({
+ $('#elx').position({
my: 'left top',
at: 'left top',
of: '#parentx',
@@ -12,7 +12,7 @@
});
same($('#elx').offset(), { top: 40, left: 40 }, 'left top, left top');
- $('#elx').positionTo({
+ $('#elx').position({
my: 'left top',
at: 'left bottom',
of: '#parentx',
@@ -20,7 +20,7 @@
});
same($('#elx').offset(), { top: 60, left: 40 }, 'left top, left bottom');
- $('#elx').positionTo({
+ $('#elx').position({
my: 'left',
at: 'bottom',
of: '#parentx',
@@ -28,7 +28,7 @@
});
same($('#elx').offset(), { top: 55, left: 50 }, 'left, bottom');
- $('#elx').positionTo({
+ $('#elx').position({
my: 'left foo',
at: 'bar baz',
of: '#parentx',
@@ -39,7 +39,7 @@
test('multiple elements', function() {
var elements = $('#el1, #el2');
- var result = elements.positionTo({
+ var result = elements.position({
my: 'left top',
at: 'left bottom',
of: '#parent',
@@ -80,7 +80,7 @@
});
var el = $("#el1");
$.each(definitions, function(index, definition) {
- el.positionTo({
+ el.position({
my: definition.my,
at: definition.at,
of: '#parent',
@@ -91,7 +91,7 @@
});
test('of', function() {
- $('#elx').positionTo({
+ $('#elx').position({
my: 'left top',
at: 'left top',
of: '#parentx',
@@ -99,7 +99,7 @@
});
same($('#elx').offset(), { top: 40, left: 40 }, 'selector');
- $('#elx').positionTo({
+ $('#elx').position({
my: 'left top',
at: 'left bottom',
of: $('#parentx'),
@@ -107,7 +107,7 @@
});
same($('#elx').offset(), { top: 60, left: 40 }, 'jQuery object');
- $('#elx').positionTo({
+ $('#elx').position({
my: 'left top',
at: 'left top',
of: $('#parentx')[0],
@@ -115,7 +115,7 @@
});
same($('#elx').offset(), { top: 40, left: 40 }, 'DOM element');
- $('#elx').positionTo({
+ $('#elx').position({
my: 'right bottom',
at: 'right bottom',
of: document,
@@ -126,7 +126,7 @@
left: $(document).width() - 10
}, 'document');
- $('#elx').positionTo({
+ $('#elx').position({
my: 'right bottom',
at: 'right bottom',
of: window,
@@ -138,7 +138,7 @@
}, 'window');
$(window).scrollTop(500).scrollLeft(200);
- $('#elx').positionTo({
+ $('#elx').position({
my: 'right bottom',
at: 'right bottom',
of: window,
@@ -151,7 +151,7 @@
$(window).scrollTop(0).scrollLeft(0);
var event = $.extend($.Event('someEvent'), { pageX: 200, pageY: 300 });
- $('#elx').positionTo({
+ $('#elx').position({
my: 'left top',
at: 'left top',
of: event,
@@ -163,7 +163,7 @@
}, 'event - left top, left top');
event = $.extend($.Event('someEvent'), { pageX: 400, pageY: 600 });
- $('#elx').positionTo({
+ $('#elx').position({
my: 'left top',
at: 'right bottom',
of: event,
@@ -176,7 +176,7 @@
});
test('offset', function() {
- $('#elx').positionTo({
+ $('#elx').position({
my: 'left top',
at: 'left bottom',
of: '#parentx',
@@ -185,7 +185,7 @@
});
same($('#elx').offset(), { top: 70, left: 50 }, 'single value');
- $('#elx').positionTo({
+ $('#elx').position({
my: 'left top',
at: 'left bottom',
of: '#parentx',
@@ -194,7 +194,7 @@
});
same($('#elx').offset(), { top: 57, left: 45 }, 'two values');
- $('#elx').positionTo({
+ $('#elx').position({
my: 'left top',
at: 'left bottom',
of: '#parentx',
@@ -210,14 +210,14 @@
var count = 0,
elems = $('#el1, #el2'),
expectedPosition = { top: 40, left: 40 },
- originalPosition = elems.positionTo({
+ originalPosition = elems.position({
my: 'right bottom',
at: 'rigt bottom',
of: '#parentx',
collision: 'none'
}).offset();
- elems.positionTo({
+ elems.position({
my: 'left top',
at: 'left top',
of: '#parentx',
@@ -234,7 +234,7 @@
});
function collisionTest(config, result, msg) {
- var elem = $("#elx").positionTo($.extend({
+ var elem = $("#elx").position($.extend({
my: "left top",
at: "right bottom",
of: window
Modified: branches/dev/positionTo/ui/ui.positionTo.js
==============================================================================
--- branches/dev/positionTo/ui/ui.positionTo.js (original)
+++ branches/dev/positionTo/ui/ui.positionTo.js Thu Jul 9 06:12:46 2009
@@ -1,20 +1,25 @@
/*
- * jQuery UI positionTo @VERSION
+ * jQuery UI Position @VERSION
*
* Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
- * TODO: create document page for positionTo and add link here
+ * TODO: create document page for position and add link here
*/
(function($) {
var horizontalPositions = /left|center|right/,
horizontalDefault = 'center',
verticalPositions = /top|center|bottom/,
- verticalDefault = 'center';
+ verticalDefault = 'center',
+ _position = $.fn.position;
+
+$.fn.position = function(options) {
+ if (!options || !options.of) {
+ return _position.apply(this, arguments);
+ }
-$.fn.positionTo = function(options) {
options = $.extend({
stackFix: true
}, options);