jquery-ui-rails 5.0.0 → 5.0.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of jquery-ui-rails might be problematic. Click here for more details.

Files changed (64) hide show
  1. data/History.md +4 -0
  2. data/README.md +4 -0
  3. data/Rakefile +2 -4
  4. data/VERSIONS.md +1 -0
  5. data/app/assets/javascripts/jquery-ui/accordion.js +2 -2
  6. data/app/assets/javascripts/jquery-ui/autocomplete.js +6 -4
  7. data/app/assets/javascripts/jquery-ui/button.js +3 -3
  8. data/app/assets/javascripts/jquery-ui/core.js +6 -5
  9. data/app/assets/javascripts/jquery-ui/datepicker.js +25 -18
  10. data/app/assets/javascripts/jquery-ui/dialog.js +22 -5
  11. data/app/assets/javascripts/jquery-ui/draggable.js +38 -33
  12. data/app/assets/javascripts/jquery-ui/droppable.js +8 -11
  13. data/app/assets/javascripts/jquery-ui/effect-blind.js +1 -1
  14. data/app/assets/javascripts/jquery-ui/effect-bounce.js +1 -1
  15. data/app/assets/javascripts/jquery-ui/effect-clip.js +1 -1
  16. data/app/assets/javascripts/jquery-ui/effect-drop.js +1 -1
  17. data/app/assets/javascripts/jquery-ui/effect-explode.js +1 -1
  18. data/app/assets/javascripts/jquery-ui/effect-fade.js +1 -1
  19. data/app/assets/javascripts/jquery-ui/effect-fold.js +1 -1
  20. data/app/assets/javascripts/jquery-ui/effect-highlight.js +1 -1
  21. data/app/assets/javascripts/jquery-ui/effect-puff.js +1 -1
  22. data/app/assets/javascripts/jquery-ui/effect-pulsate.js +1 -1
  23. data/app/assets/javascripts/jquery-ui/effect-scale.js +1 -1
  24. data/app/assets/javascripts/jquery-ui/effect-shake.js +1 -1
  25. data/app/assets/javascripts/jquery-ui/effect-size.js +1 -1
  26. data/app/assets/javascripts/jquery-ui/effect-slide.js +1 -1
  27. data/app/assets/javascripts/jquery-ui/effect-transfer.js +1 -1
  28. data/app/assets/javascripts/jquery-ui/effect.js +7 -3
  29. data/app/assets/javascripts/jquery-ui/menu.js +2 -2
  30. data/app/assets/javascripts/jquery-ui/mouse.js +2 -2
  31. data/app/assets/javascripts/jquery-ui/position.js +6 -3
  32. data/app/assets/javascripts/jquery-ui/progressbar.js +2 -2
  33. data/app/assets/javascripts/jquery-ui/resizable.js +283 -132
  34. data/app/assets/javascripts/jquery-ui/selectable.js +2 -2
  35. data/app/assets/javascripts/jquery-ui/selectmenu.js +25 -8
  36. data/app/assets/javascripts/jquery-ui/slider.js +5 -2
  37. data/app/assets/javascripts/jquery-ui/sortable.js +2 -2
  38. data/app/assets/javascripts/jquery-ui/spinner.js +2 -2
  39. data/app/assets/javascripts/jquery-ui/tabs.js +25 -21
  40. data/app/assets/javascripts/jquery-ui/tooltip.js +10 -3
  41. data/app/assets/javascripts/jquery-ui/widget.js +10 -3
  42. data/app/assets/stylesheets/jquery-ui/accordion.css.erb +1 -1
  43. data/app/assets/stylesheets/jquery-ui/all.css.erb +1 -1
  44. data/app/assets/stylesheets/jquery-ui/autocomplete.css.erb +1 -1
  45. data/app/assets/stylesheets/jquery-ui/base.css.erb +1 -1
  46. data/app/assets/stylesheets/jquery-ui/button.css.erb +1 -1
  47. data/app/assets/stylesheets/jquery-ui/core.css.erb +2 -2
  48. data/app/assets/stylesheets/jquery-ui/datepicker.css.erb +2 -2
  49. data/app/assets/stylesheets/jquery-ui/dialog.css.erb +1 -1
  50. data/app/assets/stylesheets/jquery-ui/draggable.css.erb +1 -1
  51. data/app/assets/stylesheets/jquery-ui/menu.css.erb +1 -1
  52. data/app/assets/stylesheets/jquery-ui/progressbar.css.erb +3 -8
  53. data/app/assets/stylesheets/jquery-ui/resizable.css.erb +1 -1
  54. data/app/assets/stylesheets/jquery-ui/selectable.css.erb +1 -1
  55. data/app/assets/stylesheets/jquery-ui/selectmenu.css.erb +1 -1
  56. data/app/assets/stylesheets/jquery-ui/slider.css.erb +2 -2
  57. data/app/assets/stylesheets/jquery-ui/sortable.css.erb +1 -1
  58. data/app/assets/stylesheets/jquery-ui/spinner.css.erb +1 -1
  59. data/app/assets/stylesheets/jquery-ui/tabs.css.erb +1 -1
  60. data/app/assets/stylesheets/jquery-ui/theme.css.erb +6 -6
  61. data/app/assets/stylesheets/jquery-ui/tooltip.css.erb +1 -1
  62. data/lib/jquery/ui/rails/version.rb +2 -2
  63. metadata +3 -4
  64. data/app/assets/images/jquery-ui/animated-overlay.gif +0 -0
@@ -4,7 +4,7 @@
4
4
  //= require jquery-ui/draggable
5
5
 
6
6
  /*!
7
- * jQuery UI Droppable 1.11.0
7
+ * jQuery UI Droppable 1.11.1
8
8
  * http://jqueryui.com
9
9
  *
10
10
  * Copyright 2014 jQuery Foundation and other contributors
@@ -32,7 +32,7 @@
32
32
  }(function( $ ) {
33
33
 
34
34
  $.widget( "ui.droppable", {
35
- version: "1.11.0",
35
+ version: "1.11.1",
36
36
  widgetEventPrefix: "drop",
37
37
  options: {
38
38
  accept: "*",
@@ -196,7 +196,7 @@ $.widget( "ui.droppable", {
196
196
  !inst.options.disabled &&
197
197
  inst.options.scope === draggable.options.scope &&
198
198
  inst.accept.call( inst.element[ 0 ], ( draggable.currentItem || draggable.element ) ) &&
199
- $.ui.intersect( draggable, $.extend( inst, { offset: inst.element.offset() } ), inst.options.tolerance )
199
+ $.ui.intersect( draggable, $.extend( inst, { offset: inst.element.offset() } ), inst.options.tolerance, event )
200
200
  ) { childrenIntersection = true; return false; }
201
201
  });
202
202
  if ( childrenIntersection ) {
@@ -234,14 +234,13 @@ $.ui.intersect = (function() {
234
234
  return ( x >= reference ) && ( x < ( reference + size ) );
235
235
  }
236
236
 
237
- return function( draggable, droppable, toleranceMode ) {
237
+ return function( draggable, droppable, toleranceMode, event ) {
238
238
 
239
239
  if ( !droppable.offset ) {
240
240
  return false;
241
241
  }
242
242
 
243
- var draggableLeft, draggableTop,
244
- x1 = ( draggable.positionAbs || draggable.position.absolute ).left,
243
+ var x1 = ( draggable.positionAbs || draggable.position.absolute ).left,
245
244
  y1 = ( draggable.positionAbs || draggable.position.absolute ).top,
246
245
  x2 = x1 + draggable.helperProportions.width,
247
246
  y2 = y1 + draggable.helperProportions.height,
@@ -259,9 +258,7 @@ $.ui.intersect = (function() {
259
258
  t < y1 + ( draggable.helperProportions.height / 2 ) && // Bottom Half
260
259
  y2 - ( draggable.helperProportions.height / 2 ) < b ); // Top Half
261
260
  case "pointer":
262
- draggableLeft = ( ( draggable.positionAbs || draggable.position.absolute ).left + ( draggable.clickOffset || draggable.offset.click ).left );
263
- draggableTop = ( ( draggable.positionAbs || draggable.position.absolute ).top + ( draggable.clickOffset || draggable.offset.click ).top );
264
- return isOverAxis( draggableTop, t, droppable.proportions().height ) && isOverAxis( draggableLeft, l, droppable.proportions().width );
261
+ return isOverAxis( event.pageY, t, droppable.proportions().height ) && isOverAxis( event.pageX, l, droppable.proportions().width );
265
262
  case "touch":
266
263
  return (
267
264
  ( y1 >= t && y1 <= b ) || // Top edge touching
@@ -331,7 +328,7 @@ $.ui.ddmanager = {
331
328
  if ( !this.options ) {
332
329
  return;
333
330
  }
334
- if ( !this.options.disabled && this.visible && $.ui.intersect( draggable, this, this.options.tolerance ) ) {
331
+ if ( !this.options.disabled && this.visible && $.ui.intersect( draggable, this, this.options.tolerance, event ) ) {
335
332
  dropped = this._drop.call( this, event ) || dropped;
336
333
  }
337
334
 
@@ -368,7 +365,7 @@ $.ui.ddmanager = {
368
365
  }
369
366
 
370
367
  var parentInstance, scope, parent,
371
- intersects = $.ui.intersect( draggable, this, this.options.tolerance ),
368
+ intersects = $.ui.intersect( draggable, this, this.options.tolerance, event ),
372
369
  c = !intersects && this.isover ? "isout" : ( intersects && !this.isover ? "isover" : null );
373
370
  if ( !c ) {
374
371
  return;
@@ -1,7 +1,7 @@
1
1
  //= require jquery-ui/effect
2
2
 
3
3
  /*!
4
- * jQuery UI Effects Blind 1.11.0
4
+ * jQuery UI Effects Blind 1.11.1
5
5
  * http://jqueryui.com
6
6
  *
7
7
  * Copyright 2014 jQuery Foundation and other contributors
@@ -1,7 +1,7 @@
1
1
  //= require jquery-ui/effect
2
2
 
3
3
  /*!
4
- * jQuery UI Effects Bounce 1.11.0
4
+ * jQuery UI Effects Bounce 1.11.1
5
5
  * http://jqueryui.com
6
6
  *
7
7
  * Copyright 2014 jQuery Foundation and other contributors
@@ -1,7 +1,7 @@
1
1
  //= require jquery-ui/effect
2
2
 
3
3
  /*!
4
- * jQuery UI Effects Clip 1.11.0
4
+ * jQuery UI Effects Clip 1.11.1
5
5
  * http://jqueryui.com
6
6
  *
7
7
  * Copyright 2014 jQuery Foundation and other contributors
@@ -1,7 +1,7 @@
1
1
  //= require jquery-ui/effect
2
2
 
3
3
  /*!
4
- * jQuery UI Effects Drop 1.11.0
4
+ * jQuery UI Effects Drop 1.11.1
5
5
  * http://jqueryui.com
6
6
  *
7
7
  * Copyright 2014 jQuery Foundation and other contributors
@@ -1,7 +1,7 @@
1
1
  //= require jquery-ui/effect
2
2
 
3
3
  /*!
4
- * jQuery UI Effects Explode 1.11.0
4
+ * jQuery UI Effects Explode 1.11.1
5
5
  * http://jqueryui.com
6
6
  *
7
7
  * Copyright 2014 jQuery Foundation and other contributors
@@ -1,7 +1,7 @@
1
1
  //= require jquery-ui/effect
2
2
 
3
3
  /*!
4
- * jQuery UI Effects Fade 1.11.0
4
+ * jQuery UI Effects Fade 1.11.1
5
5
  * http://jqueryui.com
6
6
  *
7
7
  * Copyright 2014 jQuery Foundation and other contributors
@@ -1,7 +1,7 @@
1
1
  //= require jquery-ui/effect
2
2
 
3
3
  /*!
4
- * jQuery UI Effects Fold 1.11.0
4
+ * jQuery UI Effects Fold 1.11.1
5
5
  * http://jqueryui.com
6
6
  *
7
7
  * Copyright 2014 jQuery Foundation and other contributors
@@ -1,7 +1,7 @@
1
1
  //= require jquery-ui/effect
2
2
 
3
3
  /*!
4
- * jQuery UI Effects Highlight 1.11.0
4
+ * jQuery UI Effects Highlight 1.11.1
5
5
  * http://jqueryui.com
6
6
  *
7
7
  * Copyright 2014 jQuery Foundation and other contributors
@@ -2,7 +2,7 @@
2
2
  //= require jquery-ui/effect-scale
3
3
 
4
4
  /*!
5
- * jQuery UI Effects Puff 1.11.0
5
+ * jQuery UI Effects Puff 1.11.1
6
6
  * http://jqueryui.com
7
7
  *
8
8
  * Copyright 2014 jQuery Foundation and other contributors
@@ -1,7 +1,7 @@
1
1
  //= require jquery-ui/effect
2
2
 
3
3
  /*!
4
- * jQuery UI Effects Pulsate 1.11.0
4
+ * jQuery UI Effects Pulsate 1.11.1
5
5
  * http://jqueryui.com
6
6
  *
7
7
  * Copyright 2014 jQuery Foundation and other contributors
@@ -2,7 +2,7 @@
2
2
  //= require jquery-ui/effect-size
3
3
 
4
4
  /*!
5
- * jQuery UI Effects Scale 1.11.0
5
+ * jQuery UI Effects Scale 1.11.1
6
6
  * http://jqueryui.com
7
7
  *
8
8
  * Copyright 2014 jQuery Foundation and other contributors
@@ -1,7 +1,7 @@
1
1
  //= require jquery-ui/effect
2
2
 
3
3
  /*!
4
- * jQuery UI Effects Shake 1.11.0
4
+ * jQuery UI Effects Shake 1.11.1
5
5
  * http://jqueryui.com
6
6
  *
7
7
  * Copyright 2014 jQuery Foundation and other contributors
@@ -1,7 +1,7 @@
1
1
  //= require jquery-ui/effect
2
2
 
3
3
  /*!
4
- * jQuery UI Effects Size 1.11.0
4
+ * jQuery UI Effects Size 1.11.1
5
5
  * http://jqueryui.com
6
6
  *
7
7
  * Copyright 2014 jQuery Foundation and other contributors
@@ -1,7 +1,7 @@
1
1
  //= require jquery-ui/effect
2
2
 
3
3
  /*!
4
- * jQuery UI Effects Slide 1.11.0
4
+ * jQuery UI Effects Slide 1.11.1
5
5
  * http://jqueryui.com
6
6
  *
7
7
  * Copyright 2014 jQuery Foundation and other contributors
@@ -1,7 +1,7 @@
1
1
  //= require jquery-ui/effect
2
2
 
3
3
  /*!
4
- * jQuery UI Effects Transfer 1.11.0
4
+ * jQuery UI Effects Transfer 1.11.1
5
5
  * http://jqueryui.com
6
6
  *
7
7
  * Copyright 2014 jQuery Foundation and other contributors
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * jQuery UI Effects 1.11.0
2
+ * jQuery UI Effects 1.11.1
3
3
  * http://jqueryui.com
4
4
  *
5
5
  * Copyright 2014 jQuery Foundation and other contributors
@@ -20,7 +20,11 @@
20
20
  }
21
21
  }(function( $ ) {
22
22
 
23
- var dataSpace = "ui-effects-";
23
+ var dataSpace = "ui-effects-",
24
+
25
+ // Create a local jQuery because jQuery Color relies on it and the
26
+ // global may not exist with AMD and a custom build (#10199)
27
+ jQuery = $;
24
28
 
25
29
  $.effects = {
26
30
  effect: {}
@@ -900,7 +904,7 @@ $.fn.extend({
900
904
  (function() {
901
905
 
902
906
  $.extend( $.effects, {
903
- version: "1.11.0",
907
+ version: "1.11.1",
904
908
 
905
909
  // Saves a set of properties in a data storage
906
910
  save: function( element, set ) {
@@ -3,7 +3,7 @@
3
3
  //= require jquery-ui/position
4
4
 
5
5
  /*!
6
- * jQuery UI Menu 1.11.0
6
+ * jQuery UI Menu 1.11.1
7
7
  * http://jqueryui.com
8
8
  *
9
9
  * Copyright 2014 jQuery Foundation and other contributors
@@ -30,7 +30,7 @@
30
30
  }(function( $ ) {
31
31
 
32
32
  return $.widget( "ui.menu", {
33
- version: "1.11.0",
33
+ version: "1.11.1",
34
34
  defaultElement: "<ul>",
35
35
  delay: 300,
36
36
  options: {
@@ -2,7 +2,7 @@
2
2
  //= require jquery-ui/widget
3
3
 
4
4
  /*!
5
- * jQuery UI Mouse 1.11.0
5
+ * jQuery UI Mouse 1.11.1
6
6
  * http://jqueryui.com
7
7
  *
8
8
  * Copyright 2014 jQuery Foundation and other contributors
@@ -32,7 +32,7 @@ $( document ).mouseup( function() {
32
32
  });
33
33
 
34
34
  return $.widget("ui.mouse", {
35
- version: "1.11.0",
35
+ version: "1.11.1",
36
36
  options: {
37
37
  cancel: "input,textarea,button,select,option",
38
38
  distance: 1,
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * jQuery UI Position 1.11.0
2
+ * jQuery UI Position 1.11.1
3
3
  * http://jqueryui.com
4
4
  *
5
5
  * Copyright 2014 jQuery Foundation and other contributors
@@ -123,8 +123,11 @@ $.position = {
123
123
  offset: withinElement.offset() || { left: 0, top: 0 },
124
124
  scrollLeft: withinElement.scrollLeft(),
125
125
  scrollTop: withinElement.scrollTop(),
126
- width: isWindow ? withinElement.width() : withinElement.outerWidth(),
127
- height: isWindow ? withinElement.height() : withinElement.outerHeight()
126
+
127
+ // support: jQuery 1.6.x
128
+ // jQuery 1.6 doesn't support .outerWidth/Height() on documents or windows
129
+ width: isWindow || isDocument ? withinElement.width() : withinElement.outerWidth(),
130
+ height: isWindow || isDocument ? withinElement.height() : withinElement.outerHeight()
128
131
  };
129
132
  }
130
133
  };
@@ -2,7 +2,7 @@
2
2
  //= require jquery-ui/widget
3
3
 
4
4
  /*!
5
- * jQuery UI Progressbar 1.11.0
5
+ * jQuery UI Progressbar 1.11.1
6
6
  * http://jqueryui.com
7
7
  *
8
8
  * Copyright 2014 jQuery Foundation and other contributors
@@ -28,7 +28,7 @@
28
28
  }(function( $ ) {
29
29
 
30
30
  return $.widget( "ui.progressbar", {
31
- version: "1.11.0",
31
+ version: "1.11.1",
32
32
  options: {
33
33
  max: 100,
34
34
  value: 0,
@@ -3,7 +3,7 @@
3
3
  //= require jquery-ui/mouse
4
4
 
5
5
  /*!
6
- * jQuery UI Resizable 1.11.0
6
+ * jQuery UI Resizable 1.11.1
7
7
  * http://jqueryui.com
8
8
  *
9
9
  * Copyright 2014 jQuery Foundation and other contributors
@@ -30,7 +30,7 @@
30
30
  }(function( $ ) {
31
31
 
32
32
  $.widget("ui.resizable", $.ui.mouse, {
33
- version: "1.11.0",
33
+ version: "1.11.1",
34
34
  widgetEventPrefix: "resize",
35
35
  options: {
36
36
  alsoResize: false,
@@ -62,7 +62,7 @@ $.widget("ui.resizable", $.ui.mouse, {
62
62
  },
63
63
 
64
64
  _isNumber: function( value ) {
65
- return !isNaN( parseInt( value , 10 ) );
65
+ return !isNaN( parseInt( value, 10 ) );
66
66
  },
67
67
 
68
68
  _hasScroll: function( el, a ) {
@@ -103,7 +103,7 @@ $.widget("ui.resizable", $.ui.mouse, {
103
103
  });
104
104
 
105
105
  // Wrap the element if it cannot hold child nodes
106
- if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)) {
106
+ if (this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)) {
107
107
 
108
108
  this.element.wrap(
109
109
  $("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({
@@ -121,14 +121,28 @@ $.widget("ui.resizable", $.ui.mouse, {
121
121
 
122
122
  this.elementIsWrapper = true;
123
123
 
124
- this.element.css({ marginLeft: this.originalElement.css("marginLeft"), marginTop: this.originalElement.css("marginTop"), marginRight: this.originalElement.css("marginRight"), marginBottom: this.originalElement.css("marginBottom") });
125
- this.originalElement.css({ marginLeft: 0, marginTop: 0, marginRight: 0, marginBottom: 0});
124
+ this.element.css({
125
+ marginLeft: this.originalElement.css("marginLeft"),
126
+ marginTop: this.originalElement.css("marginTop"),
127
+ marginRight: this.originalElement.css("marginRight"),
128
+ marginBottom: this.originalElement.css("marginBottom")
129
+ });
130
+ this.originalElement.css({
131
+ marginLeft: 0,
132
+ marginTop: 0,
133
+ marginRight: 0,
134
+ marginBottom: 0
135
+ });
126
136
  // support: Safari
127
137
  // Prevent Safari textarea resize
128
138
  this.originalResizeStyle = this.originalElement.css("resize");
129
139
  this.originalElement.css("resize", "none");
130
140
 
131
- this._proportionallyResizeElements.push(this.originalElement.css({ position: "static", zoom: 1, display: "block" }));
141
+ this._proportionallyResizeElements.push( this.originalElement.css({
142
+ position: "static",
143
+ zoom: 1,
144
+ display: "block"
145
+ }) );
132
146
 
133
147
  // support: IE9
134
148
  // avoid IE jump (hard set the margin)
@@ -137,8 +151,20 @@ $.widget("ui.resizable", $.ui.mouse, {
137
151
  this._proportionallyResize();
138
152
  }
139
153
 
140
- this.handles = o.handles || (!$(".ui-resizable-handle", this.element).length ? "e,s,se" : { n: ".ui-resizable-n", e: ".ui-resizable-e", s: ".ui-resizable-s", w: ".ui-resizable-w", se: ".ui-resizable-se", sw: ".ui-resizable-sw", ne: ".ui-resizable-ne", nw: ".ui-resizable-nw" });
141
- if(this.handles.constructor === String) {
154
+ this.handles = o.handles ||
155
+ ( !$(".ui-resizable-handle", this.element).length ?
156
+ "e,s,se" : {
157
+ n: ".ui-resizable-n",
158
+ e: ".ui-resizable-e",
159
+ s: ".ui-resizable-s",
160
+ w: ".ui-resizable-w",
161
+ se: ".ui-resizable-se",
162
+ sw: ".ui-resizable-sw",
163
+ ne: ".ui-resizable-ne",
164
+ nw: ".ui-resizable-nw"
165
+ } );
166
+
167
+ if (this.handles.constructor === String) {
142
168
 
143
169
  if ( this.handles === "all") {
144
170
  this.handles = "n,e,s,w,se,sw,ne,nw";
@@ -147,10 +173,10 @@ $.widget("ui.resizable", $.ui.mouse, {
147
173
  n = this.handles.split(",");
148
174
  this.handles = {};
149
175
 
150
- for(i = 0; i < n.length; i++) {
176
+ for (i = 0; i < n.length; i++) {
151
177
 
152
178
  handle = $.trim(n[i]);
153
- hname = "ui-resizable-"+handle;
179
+ hname = "ui-resizable-" + handle;
154
180
  axis = $("<div class='ui-resizable-handle " + hname + "'></div>");
155
181
 
156
182
  axis.css({ zIndex: o.zIndex });
@@ -160,7 +186,7 @@ $.widget("ui.resizable", $.ui.mouse, {
160
186
  axis.addClass("ui-icon ui-icon-gripsmall-diagonal-se");
161
187
  }
162
188
 
163
- this.handles[handle] = ".ui-resizable-"+handle;
189
+ this.handles[handle] = ".ui-resizable-" + handle;
164
190
  this.element.append(axis);
165
191
  }
166
192
 
@@ -172,9 +198,9 @@ $.widget("ui.resizable", $.ui.mouse, {
172
198
 
173
199
  target = target || this.element;
174
200
 
175
- for(i in this.handles) {
201
+ for (i in this.handles) {
176
202
 
177
- if(this.handles[i].constructor === String) {
203
+ if (this.handles[i].constructor === String) {
178
204
  this.handles[i] = this.element.children( this.handles[ i ] ).first().show();
179
205
  }
180
206
 
@@ -196,7 +222,7 @@ $.widget("ui.resizable", $.ui.mouse, {
196
222
  }
197
223
 
198
224
  // TODO: What's that good for? There's not anything to be executed left
199
- if(!$(this.handles[i]).length) {
225
+ if (!$(this.handles[i]).length) {
200
226
  continue;
201
227
  }
202
228
  }
@@ -228,7 +254,7 @@ $.widget("ui.resizable", $.ui.mouse, {
228
254
  $(this).removeClass("ui-resizable-autohide");
229
255
  that._handles.show();
230
256
  })
231
- .mouseleave(function(){
257
+ .mouseleave(function() {
232
258
  if (o.disabled) {
233
259
  return;
234
260
  }
@@ -249,8 +275,13 @@ $.widget("ui.resizable", $.ui.mouse, {
249
275
 
250
276
  var wrapper,
251
277
  _destroy = function(exp) {
252
- $(exp).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing")
253
- .removeData("resizable").removeData("ui-resizable").unbind(".resizable").find(".ui-resizable-handle").remove();
278
+ $(exp)
279
+ .removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing")
280
+ .removeData("resizable")
281
+ .removeData("ui-resizable")
282
+ .unbind(".resizable")
283
+ .find(".ui-resizable-handle")
284
+ .remove();
254
285
  };
255
286
 
256
287
  // TODO: Unwrap at same DOM position
@@ -307,13 +338,34 @@ $.widget("ui.resizable", $.ui.mouse, {
307
338
 
308
339
  this.offset = this.helper.offset();
309
340
  this.position = { left: curleft, top: curtop };
310
- this.size = this._helper ? { width: this.helper.width(), height: this.helper.height() } : { width: el.width(), height: el.height() };
311
- this.originalSize = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() };
341
+
342
+ this.size = this._helper ? {
343
+ width: this.helper.width(),
344
+ height: this.helper.height()
345
+ } : {
346
+ width: el.width(),
347
+ height: el.height()
348
+ };
349
+
350
+ this.originalSize = this._helper ? {
351
+ width: el.outerWidth(),
352
+ height: el.outerHeight()
353
+ } : {
354
+ width: el.width(),
355
+ height: el.height()
356
+ };
357
+
358
+ this.sizeDiff = {
359
+ width: el.outerWidth() - el.width(),
360
+ height: el.outerHeight() - el.height()
361
+ };
362
+
312
363
  this.originalPosition = { left: curleft, top: curtop };
313
- this.sizeDiff = { width: el.outerWidth() - el.width(), height: el.outerHeight() - el.height() };
314
364
  this.originalMousePosition = { left: event.pageX, top: event.pageY };
315
365
 
316
- this.aspectRatio = (typeof o.aspectRatio === "number") ? o.aspectRatio : ((this.originalSize.width / this.originalSize.height) || 1);
366
+ this.aspectRatio = (typeof o.aspectRatio === "number") ?
367
+ o.aspectRatio :
368
+ ((this.originalSize.width / this.originalSize.height) || 1);
317
369
 
318
370
  cursor = $(".ui-resizable-" + this.axis).css("cursor");
319
371
  $("body").css("cursor", cursor === "auto" ? this.axis + "-resize" : cursor);
@@ -325,28 +377,20 @@ $.widget("ui.resizable", $.ui.mouse, {
325
377
 
326
378
  _mouseDrag: function(event) {
327
379
 
328
- var data,
329
- el = this.helper, props = {},
380
+ var data, props,
330
381
  smp = this.originalMousePosition,
331
382
  a = this.axis,
332
- dx = (event.pageX-smp.left)||0,
333
- dy = (event.pageY-smp.top)||0,
383
+ dx = (event.pageX - smp.left) || 0,
384
+ dy = (event.pageY - smp.top) || 0,
334
385
  trigger = this._change[a];
335
386
 
336
- this.prevPosition = {
337
- top: this.position.top,
338
- left: this.position.left
339
- };
340
- this.prevSize = {
341
- width: this.size.width,
342
- height: this.size.height
343
- };
387
+ this._updatePrevProperties();
344
388
 
345
389
  if (!trigger) {
346
390
  return false;
347
391
  }
348
392
 
349
- data = trigger.apply(this, [event, dx, dy]);
393
+ data = trigger.apply(this, [ event, dx, dy ]);
350
394
 
351
395
  this._updateVirtualBoundaries(event.shiftKey);
352
396
  if (this._aspectRatio || event.shiftKey) {
@@ -359,26 +403,16 @@ $.widget("ui.resizable", $.ui.mouse, {
359
403
 
360
404
  this._propagate("resize", event);
361
405
 
362
- if ( this.position.top !== this.prevPosition.top ) {
363
- props.top = this.position.top + "px";
364
- }
365
- if ( this.position.left !== this.prevPosition.left ) {
366
- props.left = this.position.left + "px";
367
- }
368
- if ( this.size.width !== this.prevSize.width ) {
369
- props.width = this.size.width + "px";
370
- }
371
- if ( this.size.height !== this.prevSize.height ) {
372
- props.height = this.size.height + "px";
373
- }
374
- el.css( props );
406
+ props = this._applyChanges();
375
407
 
376
408
  if ( !this._helper && this._proportionallyResizeElements.length ) {
377
409
  this._proportionallyResize();
378
410
  }
379
411
 
380
412
  if ( !$.isEmptyObject( props ) ) {
413
+ this._updatePrevProperties();
381
414
  this._trigger( "resize", event, this.ui() );
415
+ this._applyChanges();
382
416
  }
383
417
 
384
418
  return false;
@@ -390,16 +424,21 @@ $.widget("ui.resizable", $.ui.mouse, {
390
424
  var pr, ista, soffseth, soffsetw, s, left, top,
391
425
  o = this.options, that = this;
392
426
 
393
- if(this._helper) {
427
+ if (this._helper) {
394
428
 
395
429
  pr = this._proportionallyResizeElements;
396
430
  ista = pr.length && (/textarea/i).test(pr[0].nodeName);
397
- soffseth = ista && this._hasScroll(pr[0], "left") /* TODO - jump height */ ? 0 : that.sizeDiff.height;
431
+ soffseth = ista && this._hasScroll(pr[0], "left") ? 0 : that.sizeDiff.height;
398
432
  soffsetw = ista ? 0 : that.sizeDiff.width;
399
433
 
400
- s = { width: (that.helper.width() - soffsetw), height: (that.helper.height() - soffseth) };
401
- left = (parseInt(that.element.css("left"), 10) + (that.position.left - that.originalPosition.left)) || null;
402
- top = (parseInt(that.element.css("top"), 10) + (that.position.top - that.originalPosition.top)) || null;
434
+ s = {
435
+ width: (that.helper.width() - soffsetw),
436
+ height: (that.helper.height() - soffseth)
437
+ };
438
+ left = (parseInt(that.element.css("left"), 10) +
439
+ (that.position.left - that.originalPosition.left)) || null;
440
+ top = (parseInt(that.element.css("top"), 10) +
441
+ (that.position.top - that.originalPosition.top)) || null;
403
442
 
404
443
  if (!o.animate) {
405
444
  this.element.css($.extend(s, { top: top, left: left }));
@@ -427,6 +466,38 @@ $.widget("ui.resizable", $.ui.mouse, {
427
466
 
428
467
  },
429
468
 
469
+ _updatePrevProperties: function() {
470
+ this.prevPosition = {
471
+ top: this.position.top,
472
+ left: this.position.left
473
+ };
474
+ this.prevSize = {
475
+ width: this.size.width,
476
+ height: this.size.height
477
+ };
478
+ },
479
+
480
+ _applyChanges: function() {
481
+ var props = {};
482
+
483
+ if ( this.position.top !== this.prevPosition.top ) {
484
+ props.top = this.position.top + "px";
485
+ }
486
+ if ( this.position.left !== this.prevPosition.left ) {
487
+ props.left = this.position.left + "px";
488
+ }
489
+ if ( this.size.width !== this.prevSize.width ) {
490
+ props.width = this.size.width + "px";
491
+ }
492
+ if ( this.size.height !== this.prevSize.height ) {
493
+ props.height = this.size.height + "px";
494
+ }
495
+
496
+ this.helper.css( props );
497
+
498
+ return props;
499
+ },
500
+
430
501
  _updateVirtualBoundaries: function(forceAspectRatio) {
431
502
  var pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b,
432
503
  o = this.options;
@@ -438,22 +509,22 @@ $.widget("ui.resizable", $.ui.mouse, {
438
509
  maxHeight: this._isNumber(o.maxHeight) ? o.maxHeight : Infinity
439
510
  };
440
511
 
441
- if(this._aspectRatio || forceAspectRatio) {
512
+ if (this._aspectRatio || forceAspectRatio) {
442
513
  pMinWidth = b.minHeight * this.aspectRatio;
443
514
  pMinHeight = b.minWidth / this.aspectRatio;
444
515
  pMaxWidth = b.maxHeight * this.aspectRatio;
445
516
  pMaxHeight = b.maxWidth / this.aspectRatio;
446
517
 
447
- if(pMinWidth > b.minWidth) {
518
+ if (pMinWidth > b.minWidth) {
448
519
  b.minWidth = pMinWidth;
449
520
  }
450
- if(pMinHeight > b.minHeight) {
521
+ if (pMinHeight > b.minHeight) {
451
522
  b.minHeight = pMinHeight;
452
523
  }
453
- if(pMaxWidth < b.maxWidth) {
524
+ if (pMaxWidth < b.maxWidth) {
454
525
  b.maxWidth = pMaxWidth;
455
526
  }
456
- if(pMaxHeight < b.maxHeight) {
527
+ if (pMaxHeight < b.maxHeight) {
457
528
  b.maxHeight = pMaxHeight;
458
529
  }
459
530
  }
@@ -504,8 +575,10 @@ $.widget("ui.resizable", $.ui.mouse, {
504
575
 
505
576
  var o = this._vBoundaries,
506
577
  a = this.axis,
507
- ismaxw = this._isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width), ismaxh = this._isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height),
508
- isminw = this._isNumber(data.width) && o.minWidth && (o.minWidth > data.width), isminh = this._isNumber(data.height) && o.minHeight && (o.minHeight > data.height),
578
+ ismaxw = this._isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width),
579
+ ismaxh = this._isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height),
580
+ isminw = this._isNumber(data.width) && o.minWidth && (o.minWidth > data.width),
581
+ isminh = this._isNumber(data.height) && o.minHeight && (o.minHeight > data.height),
509
582
  dw = this.originalPosition.left + this.originalSize.width,
510
583
  dh = this.position.top + this.size.height,
511
584
  cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a);
@@ -545,32 +618,56 @@ $.widget("ui.resizable", $.ui.mouse, {
545
618
  return data;
546
619
  },
547
620
 
621
+ _getPaddingPlusBorderDimensions: function( element ) {
622
+ var i = 0,
623
+ widths = [],
624
+ borders = [
625
+ element.css( "borderTopWidth" ),
626
+ element.css( "borderRightWidth" ),
627
+ element.css( "borderBottomWidth" ),
628
+ element.css( "borderLeftWidth" )
629
+ ],
630
+ paddings = [
631
+ element.css( "paddingTop" ),
632
+ element.css( "paddingRight" ),
633
+ element.css( "paddingBottom" ),
634
+ element.css( "paddingLeft" )
635
+ ];
636
+
637
+ for ( ; i < 4; i++ ) {
638
+ widths[ i ] = ( parseInt( borders[ i ], 10 ) || 0 );
639
+ widths[ i ] += ( parseInt( paddings[ i ], 10 ) || 0 );
640
+ }
641
+
642
+ return {
643
+ height: widths[ 0 ] + widths[ 2 ],
644
+ width: widths[ 1 ] + widths[ 3 ]
645
+ };
646
+ },
647
+
548
648
  _proportionallyResize: function() {
549
649
 
550
650
  if (!this._proportionallyResizeElements.length) {
551
651
  return;
552
652
  }
553
653
 
554
- var i, j, borders, paddings, prel,
654
+ var prel,
655
+ i = 0,
555
656
  element = this.helper || this.element;
556
657
 
557
- for ( i=0; i < this._proportionallyResizeElements.length; i++) {
658
+ for ( ; i < this._proportionallyResizeElements.length; i++) {
558
659
 
559
660
  prel = this._proportionallyResizeElements[i];
560
661
 
561
- if (!this.borderDif) {
562
- this.borderDif = [];
563
- borders = [prel.css("borderTopWidth"), prel.css("borderRightWidth"), prel.css("borderBottomWidth"), prel.css("borderLeftWidth")];
564
- paddings = [prel.css("paddingTop"), prel.css("paddingRight"), prel.css("paddingBottom"), prel.css("paddingLeft")];
565
-
566
- for ( j = 0; j < borders.length; j++ ) {
567
- this.borderDif[ j ] = ( parseInt( borders[ j ], 10 ) || 0 ) + ( parseInt( paddings[ j ], 10 ) || 0 );
568
- }
662
+ // TODO: Seems like a bug to cache this.outerDimensions
663
+ // considering that we are in a loop.
664
+ if (!this.outerDimensions) {
665
+ this.outerDimensions = this._getPaddingPlusBorderDimensions( prel );
569
666
  }
570
667
 
571
668
  prel.css({
572
- height: (element.height() - this.borderDif[0] - this.borderDif[2]) || 0,
573
- width: (element.width() - this.borderDif[1] - this.borderDif[3]) || 0
669
+ height: (element.height() - this.outerDimensions.height) || 0,
670
+ width: (element.width() - this.outerDimensions.width) || 0
574
671
  });
575
672
 
576
673
  }
@@ -582,7 +679,7 @@ $.widget("ui.resizable", $.ui.mouse, {
582
679
  var el = this.element, o = this.options;
583
680
  this.elementOffset = el.offset();
584
681
 
585
- if(this._helper) {
682
+ if (this._helper) {
586
683
 
587
684
  this.helper = this.helper || $("<div style='overflow:hidden;'></div>");
588
685
 
@@ -590,8 +687,8 @@ $.widget("ui.resizable", $.ui.mouse, {
590
687
  width: this.element.outerWidth() - 1,
591
688
  height: this.element.outerHeight() - 1,
592
689
  position: "absolute",
593
- left: this.elementOffset.left +"px",
594
- top: this.elementOffset.top +"px",
690
+ left: this.elementOffset.left + "px",
691
+ top: this.elementOffset.top + "px",
595
692
  zIndex: ++o.zIndex //TODO: Don't modify option
596
693
  });
597
694
 
@@ -621,21 +718,25 @@ $.widget("ui.resizable", $.ui.mouse, {
621
718
  return { height: this.originalSize.height + dy };
622
719
  },
623
720
  se: function(event, dx, dy) {
624
- return $.extend(this._change.s.apply(this, arguments), this._change.e.apply(this, [event, dx, dy]));
721
+ return $.extend(this._change.s.apply(this, arguments),
722
+ this._change.e.apply(this, [ event, dx, dy ]));
625
723
  },
626
724
  sw: function(event, dx, dy) {
627
- return $.extend(this._change.s.apply(this, arguments), this._change.w.apply(this, [event, dx, dy]));
725
+ return $.extend(this._change.s.apply(this, arguments),
726
+ this._change.w.apply(this, [ event, dx, dy ]));
628
727
  },
629
728
  ne: function(event, dx, dy) {
630
- return $.extend(this._change.n.apply(this, arguments), this._change.e.apply(this, [event, dx, dy]));
729
+ return $.extend(this._change.n.apply(this, arguments),
730
+ this._change.e.apply(this, [ event, dx, dy ]));
631
731
  },
632
732
  nw: function(event, dx, dy) {
633
- return $.extend(this._change.n.apply(this, arguments), this._change.w.apply(this, [event, dx, dy]));
733
+ return $.extend(this._change.n.apply(this, arguments),
734
+ this._change.w.apply(this, [ event, dx, dy ]));
634
735
  }
635
736
  },
636
737
 
637
738
  _propagate: function(n, event) {
638
- $.ui.plugin.call(this, n, [event, this.ui()]);
739
+ $.ui.plugin.call(this, n, [ event, this.ui() ]);
639
740
  (n !== "resize" && this._trigger(n, event, this.ui()));
640
741
  },
641
742
 
@@ -649,9 +750,7 @@ $.widget("ui.resizable", $.ui.mouse, {
649
750
  position: this.position,
650
751
  size: this.size,
651
752
  originalSize: this.originalSize,
652
- originalPosition: this.originalPosition,
653
- prevSize: this.prevSize,
654
- prevPosition: this.prevPosition
753
+ originalPosition: this.originalPosition
655
754
  };
656
755
  }
657
756
 
@@ -668,11 +767,13 @@ $.ui.plugin.add("resizable", "animate", {
668
767
  o = that.options,
669
768
  pr = that._proportionallyResizeElements,
670
769
  ista = pr.length && (/textarea/i).test(pr[0].nodeName),
671
- soffseth = ista && that._hasScroll(pr[0], "left") /* TODO - jump height */ ? 0 : that.sizeDiff.height,
770
+ soffseth = ista && that._hasScroll(pr[0], "left") ? 0 : that.sizeDiff.height,
672
771
  soffsetw = ista ? 0 : that.sizeDiff.width,
673
772
  style = { width: (that.size.width - soffsetw), height: (that.size.height - soffseth) },
674
- left = (parseInt(that.element.css("left"), 10) + (that.position.left - that.originalPosition.left)) || null,
675
- top = (parseInt(that.element.css("top"), 10) + (that.position.top - that.originalPosition.top)) || null;
773
+ left = (parseInt(that.element.css("left"), 10) +
774
+ (that.position.left - that.originalPosition.left)) || null,
775
+ top = (parseInt(that.element.css("top"), 10) +
776
+ (that.position.top - that.originalPosition.top)) || null;
676
777
 
677
778
  that.element.animate(
678
779
  $.extend(style, top && left ? { top: top, left: left } : {}), {
@@ -765,7 +866,7 @@ $.ui.plugin.add( "resizable", "containment", {
765
866
  }
766
867
  },
767
868
 
768
- resize: function( event, ui ) {
869
+ resize: function( event ) {
769
870
  var woset, hoset, isParent, isOffsetRelative,
770
871
  that = $( this ).resizable( "instance" ),
771
872
  o = that.options,
@@ -784,7 +885,11 @@ $.ui.plugin.add( "resizable", "containment", {
784
885
  }
785
886
 
786
887
  if ( cp.left < ( that._helper ? co.left : 0 ) ) {
787
- that.size.width = that.size.width + ( that._helper ? ( that.position.left - co.left ) : ( that.position.left - cop.left ) );
888
+ that.size.width = that.size.width +
889
+ ( that._helper ?
890
+ ( that.position.left - co.left ) :
891
+ ( that.position.left - cop.left ) );
892
+
788
893
  if ( pRatio ) {
789
894
  that.size.height = that.size.width / that.aspectRatio;
790
895
  continueResize = false;
@@ -793,7 +898,11 @@ $.ui.plugin.add( "resizable", "containment", {
793
898
  }
794
899
 
795
900
  if ( cp.top < ( that._helper ? co.top : 0 ) ) {
796
- that.size.height = that.size.height + ( that._helper ? ( that.position.top - co.top ) : that.position.top );
901
+ that.size.height = that.size.height +
902
+ ( that._helper ?
903
+ ( that.position.top - co.top ) :
904
+ that.position.top );
905
+
797
906
  if ( pRatio ) {
798
907
  that.size.width = that.size.height * that.aspectRatio;
799
908
  continueResize = false;
@@ -801,19 +910,27 @@ $.ui.plugin.add( "resizable", "containment", {
801
910
  that.position.top = that._helper ? co.top : 0;
802
911
  }
803
912
 
804
- that.offset.left = that.parentData.left + that.position.left;
805
- that.offset.top = that.parentData.top + that.position.top;
806
-
807
- woset = Math.abs( ( that._helper ? that.offset.left - cop.left : ( that.offset.left - co.left ) ) + that.sizeDiff.width );
808
- hoset = Math.abs( ( that._helper ? that.offset.top - cop.top : ( that.offset.top - co.top ) ) + that.sizeDiff.height );
809
-
810
913
  isParent = that.containerElement.get( 0 ) === that.element.parent().get( 0 );
811
914
  isOffsetRelative = /relative|absolute/.test( that.containerElement.css( "position" ) );
812
915
 
813
916
  if ( isParent && isOffsetRelative ) {
814
- woset -= Math.abs( that.parentData.left );
917
+ that.offset.left = that.parentData.left + that.position.left;
918
+ that.offset.top = that.parentData.top + that.position.top;
919
+ } else {
920
+ that.offset.left = that.element.offset().left;
921
+ that.offset.top = that.element.offset().top;
815
922
  }
816
923
 
924
+ woset = Math.abs( that.sizeDiff.width +
925
+ (that._helper ?
926
+ that.offset.left - cop.left :
927
+ (that.offset.left - co.left)) );
928
+
929
+ hoset = Math.abs( that.sizeDiff.height +
930
+ (that._helper ?
931
+ that.offset.top - cop.top :
932
+ (that.offset.top - co.top)) );
933
+
817
934
  if ( woset + that.size.width >= that.parentData.width ) {
818
935
  that.size.width = that.parentData.width - woset;
819
936
  if ( pRatio ) {
@@ -831,14 +948,14 @@ $.ui.plugin.add( "resizable", "containment", {
831
948
  }
832
949
 
833
950
  if ( !continueResize ){
834
- that.position.left = ui.prevPosition.left;
835
- that.position.top = ui.prevPosition.top;
836
- that.size.width = ui.prevSize.width;
837
- that.size.height = ui.prevSize.height;
951
+ that.position.left = that.prevPosition.left;
952
+ that.position.top = that.prevPosition.top;
953
+ that.size.width = that.prevSize.width;
954
+ that.size.height = that.prevSize.height;
838
955
  }
839
956
  },
840
957
 
841
- stop: function(){
958
+ stop: function() {
842
959
  var that = $( this ).resizable( "instance" ),
843
960
  o = that.options,
844
961
  co = that.containerOffset,
@@ -869,10 +986,10 @@ $.ui.plugin.add( "resizable", "containment", {
869
986
 
870
987
  $.ui.plugin.add("resizable", "alsoResize", {
871
988
 
872
- start: function () {
989
+ start: function() {
873
990
  var that = $(this).resizable( "instance" ),
874
991
  o = that.options,
875
- _store = function (exp) {
992
+ _store = function(exp) {
876
993
  $(exp).each(function() {
877
994
  var el = $(this);
878
995
  el.data("ui-resizable-alsoresize", {
@@ -883,30 +1000,42 @@ $.ui.plugin.add("resizable", "alsoResize", {
883
1000
  };
884
1001
 
885
1002
  if (typeof(o.alsoResize) === "object" && !o.alsoResize.parentNode) {
886
- if (o.alsoResize.length) { o.alsoResize = o.alsoResize[0]; _store(o.alsoResize); }
887
- else { $.each(o.alsoResize, function (exp) { _store(exp); }); }
888
- }else{
1003
+ if (o.alsoResize.length) {
1004
+ o.alsoResize = o.alsoResize[0];
1005
+ _store(o.alsoResize);
1006
+ } else {
1007
+ $.each(o.alsoResize, function(exp) {
1008
+ _store(exp);
1009
+ });
1010
+ }
1011
+ } else {
889
1012
  _store(o.alsoResize);
890
1013
  }
891
1014
  },
892
1015
 
893
- resize: function (event, ui) {
1016
+ resize: function(event, ui) {
894
1017
  var that = $(this).resizable( "instance" ),
895
1018
  o = that.options,
896
1019
  os = that.originalSize,
897
1020
  op = that.originalPosition,
898
1021
  delta = {
899
- height: (that.size.height - os.height) || 0, width: (that.size.width - os.width) || 0,
900
- top: (that.position.top - op.top) || 0, left: (that.position.left - op.left) || 0
1022
+ height: (that.size.height - os.height) || 0,
1023
+ width: (that.size.width - os.width) || 0,
1024
+ top: (that.position.top - op.top) || 0,
1025
+ left: (that.position.left - op.left) || 0
901
1026
  },
902
1027
 
903
- _alsoResize = function (exp, c) {
1028
+ _alsoResize = function(exp, c) {
904
1029
  $(exp).each(function() {
905
1030
  var el = $(this), start = $(this).data("ui-resizable-alsoresize"), style = {},
906
- css = c && c.length ? c : el.parents(ui.originalElement[0]).length ? ["width", "height"] : ["width", "height", "top", "left"];
907
-
908
- $.each(css, function (i, prop) {
909
- var sum = (start[prop]||0) + (delta[prop]||0);
1031
+ css = c && c.length ?
1032
+ c :
1033
+ el.parents(ui.originalElement[0]).length ?
1034
+ [ "width", "height" ] :
1035
+ [ "width", "height", "top", "left" ];
1036
+
1037
+ $.each(css, function(i, prop) {
1038
+ var sum = (start[prop] || 0) + (delta[prop] || 0);
910
1039
  if (sum && sum >= 0) {
911
1040
  style[prop] = sum || null;
912
1041
  }
@@ -917,13 +1046,15 @@ $.ui.plugin.add("resizable", "alsoResize", {
917
1046
  };
918
1047
 
919
1048
  if (typeof(o.alsoResize) === "object" && !o.alsoResize.nodeType) {
920
- $.each(o.alsoResize, function (exp, c) { _alsoResize(exp, c); });
921
- }else{
1049
+ $.each(o.alsoResize, function(exp, c) {
1050
+ _alsoResize(exp, c);
1051
+ });
1052
+ } else {
922
1053
  _alsoResize(o.alsoResize);
923
1054
  }
924
1055
  },
925
1056
 
926
- stop: function () {
1057
+ stop: function() {
927
1058
  $(this).removeData("resizable-alsoresize");
928
1059
  }
929
1060
  });
@@ -936,7 +1067,16 @@ $.ui.plugin.add("resizable", "ghost", {
936
1067
 
937
1068
  that.ghost = that.originalElement.clone();
938
1069
  that.ghost
939
- .css({ opacity: 0.25, display: "block", position: "relative", height: cs.height, width: cs.width, margin: 0, left: 0, top: 0 })
1070
+ .css({
1071
+ opacity: 0.25,
1072
+ display: "block",
1073
+ position: "relative",
1074
+ height: cs.height,
1075
+ width: cs.width,
1076
+ margin: 0,
1077
+ left: 0,
1078
+ top: 0
1079
+ })
940
1080
  .addClass("ui-resizable-ghost")
941
1081
  .addClass(typeof o.ghost === "string" ? o.ghost : "");
942
1082
 
@@ -944,10 +1084,14 @@ $.ui.plugin.add("resizable", "ghost", {
944
1084
 
945
1085
  },
946
1086
 
947
- resize: function(){
1087
+ resize: function() {
948
1088
  var that = $(this).resizable( "instance" );
949
1089
  if (that.ghost) {
950
- that.ghost.css({ position: "relative", height: that.size.height, width: that.size.width });
1090
+ that.ghost.css({
1091
+ position: "relative",
1092
+ height: that.size.height,
1093
+ width: that.size.width
1094
+ });
951
1095
  }
952
1096
  },
953
1097
 
@@ -963,15 +1107,16 @@ $.ui.plugin.add("resizable", "ghost", {
963
1107
  $.ui.plugin.add("resizable", "grid", {
964
1108
 
965
1109
  resize: function() {
966
- var that = $(this).resizable( "instance" ),
1110
+ var outerDimensions,
1111
+ that = $(this).resizable( "instance" ),
967
1112
  o = that.options,
968
1113
  cs = that.size,
969
1114
  os = that.originalSize,
970
1115
  op = that.originalPosition,
971
1116
  a = that.axis,
972
- grid = typeof o.grid === "number" ? [o.grid, o.grid] : o.grid,
973
- gridX = (grid[0]||1),
974
- gridY = (grid[1]||1),
1117
+ grid = typeof o.grid === "number" ? [ o.grid, o.grid ] : o.grid,
1118
+ gridX = (grid[0] || 1),
1119
+ gridY = (grid[1] || 1),
975
1120
  ox = Math.round((cs.width - os.width) / gridX) * gridX,
976
1121
  oy = Math.round((cs.height - os.height) / gridY) * gridY,
977
1122
  newWidth = os.width + ox,
@@ -984,16 +1129,16 @@ $.ui.plugin.add("resizable", "grid", {
984
1129
  o.grid = grid;
985
1130
 
986
1131
  if (isMinWidth) {
987
- newWidth = newWidth + gridX;
1132
+ newWidth += gridX;
988
1133
  }
989
1134
  if (isMinHeight) {
990
- newHeight = newHeight + gridY;
1135
+ newHeight += gridY;
991
1136
  }
992
1137
  if (isMaxWidth) {
993
- newWidth = newWidth - gridX;
1138
+ newWidth -= gridX;
994
1139
  }
995
1140
  if (isMaxHeight) {
996
- newHeight = newHeight - gridY;
1141
+ newHeight -= gridY;
997
1142
  }
998
1143
 
999
1144
  if (/^(se|s|e)$/.test(a)) {
@@ -1008,19 +1153,25 @@ $.ui.plugin.add("resizable", "grid", {
1008
1153
  that.size.height = newHeight;
1009
1154
  that.position.left = op.left - ox;
1010
1155
  } else {
1156
+ if ( newHeight - gridY <= 0 || newWidth - gridX <= 0) {
1157
+ outerDimensions = that._getPaddingPlusBorderDimensions( this );
1158
+ }
1159
+
1011
1160
  if ( newHeight - gridY > 0 ) {
1012
1161
  that.size.height = newHeight;
1013
1162
  that.position.top = op.top - oy;
1014
1163
  } else {
1015
- that.size.height = gridY;
1016
- that.position.top = op.top + os.height - gridY;
1164
+ newHeight = gridY - outerDimensions.height;
1165
+ that.size.height = newHeight;
1166
+ that.position.top = op.top + os.height - newHeight;
1017
1167
  }
1018
1168
  if ( newWidth - gridX > 0 ) {
1019
1169
  that.size.width = newWidth;
1020
1170
  that.position.left = op.left - ox;
1021
1171
  } else {
1022
- that.size.width = gridX;
1023
- that.position.left = op.left + os.width - gridX;
1172
+ newWidth = gridY - outerDimensions.height;
1173
+ that.size.width = newWidth;
1174
+ that.position.left = op.left + os.width - newWidth;
1024
1175
  }
1025
1176
  }
1026
1177
  }