jquery-ui-rails 2.0.2 → 3.0.0

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 (131) hide show
  1. data/History.md +15 -0
  2. data/License.txt +2 -3
  3. data/README.md +17 -19
  4. data/Rakefile +79 -28
  5. data/lib/jquery/ui/rails/version.rb +1 -1
  6. data/vendor/assets/javascripts/jquery.ui.accordion.js +537 -417
  7. data/vendor/assets/javascripts/jquery.ui.all.js +17 -14
  8. data/vendor/assets/javascripts/jquery.ui.autocomplete.js +311 -339
  9. data/vendor/assets/javascripts/jquery.ui.button.js +63 -59
  10. data/vendor/assets/javascripts/jquery.ui.core.js +134 -112
  11. data/vendor/assets/javascripts/jquery.ui.datepicker-ar-DZ.js +2 -2
  12. data/vendor/assets/javascripts/jquery.ui.datepicker-ar.js +3 -3
  13. data/vendor/assets/javascripts/jquery.ui.datepicker-az.js +3 -3
  14. data/vendor/assets/javascripts/jquery.ui.datepicker-bg.js +16 -16
  15. data/vendor/assets/javascripts/jquery.ui.datepicker-bs.js +5 -5
  16. data/vendor/assets/javascripts/jquery.ui.datepicker-ca.js +13 -13
  17. data/vendor/assets/javascripts/jquery.ui.datepicker-cs.js +3 -3
  18. data/vendor/assets/javascripts/jquery.ui.datepicker-cy-GB.js +1 -1
  19. data/vendor/assets/javascripts/jquery.ui.datepicker-da.js +9 -9
  20. data/vendor/assets/javascripts/jquery.ui.datepicker-de.js +2 -2
  21. data/vendor/assets/javascripts/jquery.ui.datepicker-el.js +1 -1
  22. data/vendor/assets/javascripts/jquery.ui.datepicker-eo.js +2 -2
  23. data/vendor/assets/javascripts/jquery.ui.datepicker-es.js +6 -6
  24. data/vendor/assets/javascripts/jquery.ui.datepicker-et.js +1 -1
  25. data/vendor/assets/javascripts/jquery.ui.datepicker-eu.js +3 -3
  26. data/vendor/assets/javascripts/jquery.ui.datepicker-fa.js +3 -3
  27. data/vendor/assets/javascripts/jquery.ui.datepicker-fi.js +5 -5
  28. data/vendor/assets/javascripts/jquery.ui.datepicker-fo.js +3 -3
  29. data/vendor/assets/javascripts/jquery.ui.datepicker-fr-CH.js +3 -3
  30. data/vendor/assets/javascripts/jquery.ui.datepicker-fr.js +2 -2
  31. data/vendor/assets/javascripts/jquery.ui.datepicker-gl.js +6 -6
  32. data/vendor/assets/javascripts/jquery.ui.datepicker-he.js +2 -2
  33. data/vendor/assets/javascripts/jquery.ui.datepicker-hr.js +3 -3
  34. data/vendor/assets/javascripts/jquery.ui.datepicker-hy.js +3 -3
  35. data/vendor/assets/javascripts/jquery.ui.datepicker-id.js +3 -3
  36. data/vendor/assets/javascripts/jquery.ui.datepicker-is.js +11 -11
  37. data/vendor/assets/javascripts/jquery.ui.datepicker-it.js +3 -3
  38. data/vendor/assets/javascripts/jquery.ui.datepicker-ja.js +3 -3
  39. data/vendor/assets/javascripts/jquery.ui.datepicker-kk.js +2 -2
  40. data/vendor/assets/javascripts/jquery.ui.datepicker-ko.js +1 -1
  41. data/vendor/assets/javascripts/jquery.ui.datepicker-lt.js +3 -3
  42. data/vendor/assets/javascripts/jquery.ui.datepicker-lv.js +1 -1
  43. data/vendor/assets/javascripts/jquery.ui.datepicker-ml.js +1 -1
  44. data/vendor/assets/javascripts/jquery.ui.datepicker-ms.js +3 -3
  45. data/vendor/assets/javascripts/jquery.ui.datepicker-nl.js +1 -1
  46. data/vendor/assets/javascripts/jquery.ui.datepicker-no.js +18 -18
  47. data/vendor/assets/javascripts/jquery.ui.datepicker-pl.js +2 -2
  48. data/vendor/assets/javascripts/jquery.ui.datepicker-pt-BR.js +7 -7
  49. data/vendor/assets/javascripts/jquery.ui.datepicker-pt.js +6 -6
  50. data/vendor/assets/javascripts/jquery.ui.datepicker-rm.js +2 -2
  51. data/vendor/assets/javascripts/jquery.ui.datepicker-ro.js +2 -2
  52. data/vendor/assets/javascripts/jquery.ui.datepicker-ru.js +3 -3
  53. data/vendor/assets/javascripts/jquery.ui.datepicker-sk.js +2 -2
  54. data/vendor/assets/javascripts/jquery.ui.datepicker-sl.js +6 -6
  55. data/vendor/assets/javascripts/jquery.ui.datepicker-sq.js +2 -2
  56. data/vendor/assets/javascripts/jquery.ui.datepicker-sr-SR.js +2 -2
  57. data/vendor/assets/javascripts/jquery.ui.datepicker-sr.js +2 -2
  58. data/vendor/assets/javascripts/jquery.ui.datepicker-sv.js +9 -9
  59. data/vendor/assets/javascripts/jquery.ui.datepicker-th.js +3 -3
  60. data/vendor/assets/javascripts/jquery.ui.datepicker-tj.js +1 -1
  61. data/vendor/assets/javascripts/jquery.ui.datepicker-tr.js +2 -2
  62. data/vendor/assets/javascripts/jquery.ui.datepicker-uk.js +3 -3
  63. data/vendor/assets/javascripts/jquery.ui.datepicker-vi.js +2 -2
  64. data/vendor/assets/javascripts/jquery.ui.datepicker-zh-CN.js +2 -2
  65. data/vendor/assets/javascripts/jquery.ui.datepicker-zh-HK.js +2 -2
  66. data/vendor/assets/javascripts/jquery.ui.datepicker-zh-TW.js +2 -2
  67. data/vendor/assets/javascripts/jquery.ui.datepicker.js +51 -59
  68. data/vendor/assets/javascripts/jquery.ui.dialog.js +402 -409
  69. data/vendor/assets/javascripts/jquery.ui.draggable.js +79 -75
  70. data/vendor/assets/javascripts/jquery.ui.droppable.js +10 -17
  71. data/vendor/assets/javascripts/jquery.ui.effect-blind.js +84 -0
  72. data/vendor/assets/javascripts/jquery.ui.effect-bounce.js +115 -0
  73. data/vendor/assets/javascripts/jquery.ui.effect-clip.js +69 -0
  74. data/vendor/assets/javascripts/jquery.ui.effect-drop.js +67 -0
  75. data/vendor/assets/javascripts/jquery.ui.effect-explode.js +99 -0
  76. data/vendor/assets/javascripts/jquery.ui.effect-fade.js +32 -0
  77. data/vendor/assets/javascripts/jquery.ui.effect-fold.js +78 -0
  78. data/vendor/assets/javascripts/jquery.ui.effect-highlight.js +52 -0
  79. data/vendor/assets/javascripts/jquery.ui.effect-pulsate.js +65 -0
  80. data/vendor/assets/javascripts/jquery.ui.effect-scale.js +320 -0
  81. data/vendor/assets/javascripts/jquery.ui.effect-shake.js +76 -0
  82. data/vendor/assets/javascripts/jquery.ui.effect-slide.js +66 -0
  83. data/vendor/assets/javascripts/jquery.ui.effect-transfer.js +49 -0
  84. data/vendor/assets/javascripts/jquery.ui.effect.all.js +14 -0
  85. data/vendor/assets/javascripts/jquery.ui.effect.js +1276 -0
  86. data/vendor/assets/javascripts/jquery.ui.menu.js +614 -0
  87. data/vendor/assets/javascripts/jquery.ui.mouse.js +22 -20
  88. data/vendor/assets/javascripts/jquery.ui.position.js +367 -158
  89. data/vendor/assets/javascripts/jquery.ui.progressbar.js +10 -14
  90. data/vendor/assets/javascripts/jquery.ui.resizable.js +143 -149
  91. data/vendor/assets/javascripts/jquery.ui.selectable.js +22 -28
  92. data/vendor/assets/javascripts/jquery.ui.slider.js +88 -106
  93. data/vendor/assets/javascripts/jquery.ui.sortable.js +97 -95
  94. data/vendor/assets/javascripts/jquery.ui.spinner.js +482 -0
  95. data/vendor/assets/javascripts/jquery.ui.tabs.js +1189 -580
  96. data/vendor/assets/javascripts/jquery.ui.tooltip.js +402 -0
  97. data/vendor/assets/javascripts/jquery.ui.widget.js +373 -117
  98. data/vendor/assets/stylesheets/jquery.ui.accordion.css.erb +10 -13
  99. data/vendor/assets/stylesheets/jquery.ui.all.css.erb +4 -3
  100. data/vendor/assets/stylesheets/jquery.ui.autocomplete.css.erb +10 -44
  101. data/vendor/assets/stylesheets/jquery.ui.base.css.erb +7 -3
  102. data/vendor/assets/stylesheets/jquery.ui.button.css.erb +6 -4
  103. data/vendor/assets/stylesheets/jquery.ui.core.css.erb +5 -4
  104. data/vendor/assets/stylesheets/jquery.ui.datepicker.css.erb +4 -3
  105. data/vendor/assets/stylesheets/jquery.ui.dialog.css.erb +6 -5
  106. data/vendor/assets/stylesheets/jquery.ui.menu.css.erb +34 -0
  107. data/vendor/assets/stylesheets/jquery.ui.progressbar.css.erb +4 -3
  108. data/vendor/assets/stylesheets/jquery.ui.resizable.css.erb +4 -3
  109. data/vendor/assets/stylesheets/jquery.ui.selectable.css.erb +4 -3
  110. data/vendor/assets/stylesheets/jquery.ui.slider.css.erb +4 -3
  111. data/vendor/assets/stylesheets/jquery.ui.spinner.css.erb +27 -0
  112. data/vendor/assets/stylesheets/jquery.ui.tabs.css.erb +8 -8
  113. data/vendor/assets/stylesheets/jquery.ui.theme.css.erb +8 -7
  114. data/vendor/assets/stylesheets/jquery.ui.tooltip.css.erb +25 -0
  115. metadata +24 -19
  116. data/dependencies.js +0 -31
  117. data/vendor/assets/javascripts/jquery.effects.all.js +0 -14
  118. data/vendor/assets/javascripts/jquery.effects.blind.js +0 -51
  119. data/vendor/assets/javascripts/jquery.effects.bounce.js +0 -80
  120. data/vendor/assets/javascripts/jquery.effects.clip.js +0 -56
  121. data/vendor/assets/javascripts/jquery.effects.core.js +0 -612
  122. data/vendor/assets/javascripts/jquery.effects.drop.js +0 -52
  123. data/vendor/assets/javascripts/jquery.effects.explode.js +0 -81
  124. data/vendor/assets/javascripts/jquery.effects.fade.js +0 -34
  125. data/vendor/assets/javascripts/jquery.effects.fold.js +0 -58
  126. data/vendor/assets/javascripts/jquery.effects.highlight.js +0 -52
  127. data/vendor/assets/javascripts/jquery.effects.pulsate.js +0 -53
  128. data/vendor/assets/javascripts/jquery.effects.scale.js +0 -180
  129. data/vendor/assets/javascripts/jquery.effects.shake.js +0 -59
  130. data/vendor/assets/javascripts/jquery.effects.slide.js +0 -52
  131. data/vendor/assets/javascripts/jquery.effects.transfer.js +0 -47
@@ -3,7 +3,7 @@
3
3
  jQuery(function($){
4
4
  $.datepicker.regional['tr'] = {
5
5
  closeText: 'kapat',
6
- prevText: '<geri',
6
+ prevText: '<geri',
7
7
  nextText: 'ileri&#x3e',
8
8
  currentText: 'bugün',
9
9
  monthNames: ['Ocak','Şubat','Mart','Nisan','Mayıs','Haziran',
@@ -20,4 +20,4 @@ jQuery(function($){
20
20
  showMonthAfterYear: false,
21
21
  yearSuffix: ''};
22
22
  $.datepicker.setDefaults($.datepicker.regional['tr']);
23
- });
23
+ });
@@ -4,8 +4,8 @@
4
4
  jQuery(function($){
5
5
  $.datepicker.regional['uk'] = {
6
6
  closeText: 'Закрити',
7
- prevText: '<',
8
- nextText: '>',
7
+ prevText: '<',
8
+ nextText: '>',
9
9
  currentText: 'Сьогодні',
10
10
  monthNames: ['Січень','Лютий','Березень','Квітень','Травень','Червень',
11
11
  'Липень','Серпень','Вересень','Жовтень','Листопад','Грудень'],
@@ -21,4 +21,4 @@ jQuery(function($){
21
21
  showMonthAfterYear: false,
22
22
  yearSuffix: ''};
23
23
  $.datepicker.setDefaults($.datepicker.regional['uk']);
24
- });
24
+ });
@@ -3,8 +3,8 @@
3
3
  jQuery(function($){
4
4
  $.datepicker.regional['vi'] = {
5
5
  closeText: 'Đóng',
6
- prevText: '<Trước',
7
- nextText: 'Tiếp>',
6
+ prevText: '<Trước',
7
+ nextText: 'Tiếp>',
8
8
  currentText: 'Hôm nay',
9
9
  monthNames: ['Tháng Một', 'Tháng Hai', 'Tháng Ba', 'Tháng Tư', 'Tháng Năm', 'Tháng Sáu',
10
10
  'Tháng Bảy', 'Tháng Tám', 'Tháng Chín', 'Tháng Mười', 'Tháng Mười Một', 'Tháng Mười Hai'],
@@ -3,8 +3,8 @@
3
3
  jQuery(function($){
4
4
  $.datepicker.regional['zh-CN'] = {
5
5
  closeText: '关闭',
6
- prevText: '<上月',
7
- nextText: '下月>',
6
+ prevText: '<上月',
7
+ nextText: '下月>',
8
8
  currentText: '今天',
9
9
  monthNames: ['一月','二月','三月','四月','五月','六月',
10
10
  '七月','八月','九月','十月','十一月','十二月'],
@@ -3,8 +3,8 @@
3
3
  jQuery(function($){
4
4
  $.datepicker.regional['zh-HK'] = {
5
5
  closeText: '關閉',
6
- prevText: '<上月',
7
- nextText: '下月>',
6
+ prevText: '<上月',
7
+ nextText: '下月>',
8
8
  currentText: '今天',
9
9
  monthNames: ['一月','二月','三月','四月','五月','六月',
10
10
  '七月','八月','九月','十月','十一月','十二月'],
@@ -3,8 +3,8 @@
3
3
  jQuery(function($){
4
4
  $.datepicker.regional['zh-TW'] = {
5
5
  closeText: '關閉',
6
- prevText: '<上月',
7
- nextText: '下月>',
6
+ prevText: '<上月',
7
+ nextText: '下月>',
8
8
  currentText: '今天',
9
9
  monthNames: ['一月','二月','三月','四月','五月','六月',
10
10
  '七月','八月','九月','十月','十一月','十二月'],
@@ -1,20 +1,21 @@
1
1
  //= require jquery.ui.core
2
2
 
3
3
  /*!
4
- * jQuery UI Datepicker 1.8.24
4
+ * jQuery UI Datepicker 1.9.2
5
+ * http://jqueryui.com
5
6
  *
6
- * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
7
- * Dual licensed under the MIT or GPL Version 2 licenses.
7
+ * Copyright 2012 jQuery Foundation and other contributors
8
+ * Released under the MIT license.
8
9
  * http://jquery.org/license
9
10
  *
10
- * http://docs.jquery.com/UI/Datepicker
11
+ * http://api.jqueryui.com/datepicker/
11
12
  *
12
13
  * Depends:
13
14
  * jquery.ui.core.js
14
15
  */
15
16
  (function( $, undefined ) {
16
17
 
17
- $.extend($.ui, { datepicker: { version: "1.8.24" } });
18
+ $.extend($.ui, { datepicker: { version: "1.9.2" } });
18
19
 
19
20
  var PROP_NAME = 'datepicker';
20
21
  var dpuuid = new Date().getTime();
@@ -117,7 +118,7 @@ function Datepicker() {
117
118
  $.extend(Datepicker.prototype, {
118
119
  /* Class name added to elements to indicate already configured with a date picker. */
119
120
  markerClassName: 'hasDatepicker',
120
-
121
+
121
122
  //Keep track of the maximum number of rows displayed (see #7043)
122
123
  maxRows: 4,
123
124
 
@@ -126,7 +127,7 @@ $.extend(Datepicker.prototype, {
126
127
  if (this.debug)
127
128
  console.log.apply('', arguments);
128
129
  },
129
-
130
+
130
131
  // TODO rename to "widget" when switching to widget factory
131
132
  _widgetDatepicker: function() {
132
133
  return this.dpDiv;
@@ -236,7 +237,7 @@ $.extend(Datepicker.prototype, {
236
237
  if ($.datepicker._datepickerShowing && $.datepicker._lastInput == input[0])
237
238
  $.datepicker._hideDatepicker();
238
239
  else if ($.datepicker._datepickerShowing && $.datepicker._lastInput != input[0]) {
239
- $.datepicker._hideDatepicker();
240
+ $.datepicker._hideDatepicker();
240
241
  $.datepicker._showDatepicker(input[0]);
241
242
  } else
242
243
  $.datepicker._showDatepicker(input[0]);
@@ -384,7 +385,7 @@ $.extend(Datepicker.prototype, {
384
385
  var inline = $target.children('.' + this._inlineClass);
385
386
  inline.children().removeClass('ui-state-disabled');
386
387
  inline.find("select.ui-datepicker-month, select.ui-datepicker-year").
387
- removeAttr("disabled");
388
+ prop("disabled", false);
388
389
  }
389
390
  this._disabledInputs = $.map(this._disabledInputs,
390
391
  function(value) { return (value == target ? null : value); }); // delete entry
@@ -409,7 +410,7 @@ $.extend(Datepicker.prototype, {
409
410
  var inline = $target.children('.' + this._inlineClass);
410
411
  inline.children().addClass('ui-state-disabled');
411
412
  inline.find("select.ui-datepicker-month, select.ui-datepicker-year").
412
- attr("disabled", "disabled");
413
+ prop("disabled", true);
413
414
  }
414
415
  this._disabledInputs = $.map(this._disabledInputs,
415
416
  function(value) { return (value == target ? null : value); }); // delete entry
@@ -532,7 +533,7 @@ $.extend(Datepicker.prototype, {
532
533
  case 9: $.datepicker._hideDatepicker();
533
534
  handled = false;
534
535
  break; // hide on tab out
535
- case 13: var sel = $('td.' + $.datepicker._dayOverClass + ':not(.' +
536
+ case 13: var sel = $('td.' + $.datepicker._dayOverClass + ':not(.' +
536
537
  $.datepicker._currentClass + ')', inst.dpDiv);
537
538
  if (sel[0])
538
539
  $.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]);
@@ -630,7 +631,7 @@ $.extend(Datepicker.prototype, {
630
631
  },
631
632
 
632
633
  /* Pop-up the date picker for a given input field.
633
- If false returned from beforeShow event handler do not show.
634
+ If false returned from beforeShow event handler do not show.
634
635
  @param input element - the input field attached to the date picker or
635
636
  event - if triggered by focus */
636
637
  _showDatepicker: function(input) {
@@ -649,7 +650,7 @@ $.extend(Datepicker.prototype, {
649
650
  var beforeShow = $.datepicker._get(inst, 'beforeShow');
650
651
  var beforeShowSettings = beforeShow ? beforeShow.apply(input, [input, inst]) : {};
651
652
  if(beforeShowSettings === false){
652
- //false
653
+ //false
653
654
  return;
654
655
  }
655
656
  extendRemove(inst.settings, beforeShowSettings);
@@ -667,10 +668,6 @@ $.extend(Datepicker.prototype, {
667
668
  isFixed |= $(this).css('position') == 'fixed';
668
669
  return !isFixed;
669
670
  });
670
- if (isFixed && $.browser.opera) { // correction for Opera when fixed and scrolled
671
- $.datepicker._pos[0] -= document.documentElement.scrollLeft;
672
- $.datepicker._pos[1] -= document.documentElement.scrollTop;
673
- }
674
671
  var offset = {left: $.datepicker._pos[0], top: $.datepicker._pos[1]};
675
672
  $.datepicker._pos = null;
676
673
  //to avoid flashes on Firefox
@@ -697,7 +694,9 @@ $.extend(Datepicker.prototype, {
697
694
  };
698
695
  inst.dpDiv.zIndex($(input).zIndex()+1);
699
696
  $.datepicker._datepickerShowing = true;
700
- if ($.effects && $.effects[showAnim])
697
+
698
+ // DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed
699
+ if ( $.effects && ( $.effects.effect[ showAnim ] || $.effects[ showAnim ] ) )
701
700
  inst.dpDiv.show(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess);
702
701
  else
703
702
  inst.dpDiv[showAnim || 'show']((showAnim ? duration : null), postProcess);
@@ -711,8 +710,7 @@ $.extend(Datepicker.prototype, {
711
710
 
712
711
  /* Generate the date picker content. */
713
712
  _updateDatepicker: function(inst) {
714
- var self = this;
715
- self.maxRows = 4; //Reset the max number of rows being displayed (see #7043)
713
+ this.maxRows = 4; //Reset the max number of rows being displayed (see #7043)
716
714
  var borders = $.datepicker._getBorders(inst.dpDiv);
717
715
  instActive = inst; // for delegate hover events
718
716
  inst.dpDiv.empty().append(this._generateHTML(inst));
@@ -737,7 +735,7 @@ $.extend(Datepicker.prototype, {
737
735
  // this breaks the change event in IE
738
736
  inst.input.is(':visible') && !inst.input.is(':disabled') && inst.input[0] != document.activeElement)
739
737
  inst.input.focus();
740
- // deffered render of the years select (to avoid flashes on Firefox)
738
+ // deffered render of the years select (to avoid flashes on Firefox)
741
739
  if( inst.yearshtml ){
742
740
  var origyearshtml = inst.yearshtml;
743
741
  setTimeout(function(){
@@ -787,11 +785,11 @@ $.extend(Datepicker.prototype, {
787
785
  _findPos: function(obj) {
788
786
  var inst = this._getInst(obj);
789
787
  var isRTL = this._get(inst, 'isRTL');
790
- while (obj && (obj.type == 'hidden' || obj.nodeType != 1 || $.expr.filters.hidden(obj))) {
791
- obj = obj[isRTL ? 'previousSibling' : 'nextSibling'];
792
- }
793
- var position = $(obj).offset();
794
- return [position.left, position.top];
788
+ while (obj && (obj.type == 'hidden' || obj.nodeType != 1 || $.expr.filters.hidden(obj))) {
789
+ obj = obj[isRTL ? 'previousSibling' : 'nextSibling'];
790
+ }
791
+ var position = $(obj).offset();
792
+ return [position.left, position.top];
795
793
  },
796
794
 
797
795
  /* Hide the date picker from view.
@@ -806,7 +804,9 @@ $.extend(Datepicker.prototype, {
806
804
  var postProcess = function() {
807
805
  $.datepicker._tidyDialog(inst);
808
806
  };
809
- if ($.effects && $.effects[showAnim])
807
+
808
+ // DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed
809
+ if ( $.effects && ( $.effects.effect[ showAnim ] || $.effects[ showAnim ] ) )
810
810
  inst.dpDiv.hide(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess);
811
811
  else
812
812
  inst.dpDiv[(showAnim == 'slideDown' ? 'slideUp' :
@@ -1098,7 +1098,10 @@ $.extend(Datepicker.prototype, {
1098
1098
  }
1099
1099
  }
1100
1100
  if (iValue < value.length){
1101
- throw "Extra/unparsed characters found in date: " + value.substring(iValue);
1101
+ var extra = value.substr(iValue);
1102
+ if (!/^\s+/.test(extra)) {
1103
+ throw "Extra/unparsed characters found in date: " + extra;
1104
+ }
1102
1105
  }
1103
1106
  if (year == -1)
1104
1107
  year = new Date().getFullYear();
@@ -1441,7 +1444,7 @@ $.extend(Datepicker.prototype, {
1441
1444
  $(this).bind(this.getAttribute('data-event'), handler[this.getAttribute('data-handler')]);
1442
1445
  });
1443
1446
  },
1444
-
1447
+
1445
1448
  /* Generate the HTML for the current state of the date picker. */
1446
1449
  _generateHTML: function(inst) {
1447
1450
  var today = new Date();
@@ -1598,13 +1601,13 @@ $.extend(Datepicker.prototype, {
1598
1601
  drawMonth = 0;
1599
1602
  drawYear++;
1600
1603
  }
1601
- calender += '</tbody></table>' + (isMultiMonth ? '</div>' +
1604
+ calender += '</tbody></table>' + (isMultiMonth ? '</div>' +
1602
1605
  ((numMonths[0] > 0 && col == numMonths[1]-1) ? '<div class="ui-datepicker-row-break"></div>' : '') : '');
1603
1606
  group += calender;
1604
1607
  }
1605
1608
  html += group;
1606
1609
  }
1607
- html += buttonPanel + ($.browser.msie && parseInt($.browser.version,10) < 7 && !inst.inline ?
1610
+ html += buttonPanel + ($.ui.ie6 && !inst.inline ?
1608
1611
  '<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>' : '');
1609
1612
  inst._keyEvent = false;
1610
1613
  return html;
@@ -1662,7 +1665,7 @@ $.extend(Datepicker.prototype, {
1662
1665
  '>' + year + '</option>';
1663
1666
  }
1664
1667
  inst.yearshtml += '</select>';
1665
-
1668
+
1666
1669
  html += inst.yearshtml;
1667
1670
  inst.yearshtml = null;
1668
1671
  }
@@ -1773,26 +1776,21 @@ $.extend(Datepicker.prototype, {
1773
1776
  * Bind hover events for datepicker elements.
1774
1777
  * Done via delegate so the binding only occurs once in the lifetime of the parent div.
1775
1778
  * Global instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker.
1776
- */
1779
+ */
1777
1780
  function bindHover(dpDiv) {
1778
1781
  var selector = 'button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a';
1779
- return dpDiv.bind('mouseout', function(event) {
1780
- var elem = $( event.target ).closest( selector );
1781
- if ( !elem.length ) {
1782
- return;
1783
- }
1784
- elem.removeClass( "ui-state-hover ui-datepicker-prev-hover ui-datepicker-next-hover" );
1782
+ return dpDiv.delegate(selector, 'mouseout', function() {
1783
+ $(this).removeClass('ui-state-hover');
1784
+ if (this.className.indexOf('ui-datepicker-prev') != -1) $(this).removeClass('ui-datepicker-prev-hover');
1785
+ if (this.className.indexOf('ui-datepicker-next') != -1) $(this).removeClass('ui-datepicker-next-hover');
1785
1786
  })
1786
- .bind('mouseover', function(event) {
1787
- var elem = $( event.target ).closest( selector );
1788
- if ($.datepicker._isDisabledDatepicker( instActive.inline ? dpDiv.parent()[0] : instActive.input[0]) ||
1789
- !elem.length ) {
1790
- return;
1787
+ .delegate(selector, 'mouseover', function(){
1788
+ if (!$.datepicker._isDisabledDatepicker( instActive.inline ? dpDiv.parent()[0] : instActive.input[0])) {
1789
+ $(this).parents('.ui-datepicker-calendar').find('a').removeClass('ui-state-hover');
1790
+ $(this).addClass('ui-state-hover');
1791
+ if (this.className.indexOf('ui-datepicker-prev') != -1) $(this).addClass('ui-datepicker-prev-hover');
1792
+ if (this.className.indexOf('ui-datepicker-next') != -1) $(this).addClass('ui-datepicker-next-hover');
1791
1793
  }
1792
- elem.parents('.ui-datepicker-calendar').find('a').removeClass('ui-state-hover');
1793
- elem.addClass('ui-state-hover');
1794
- if (elem.hasClass('ui-datepicker-prev')) elem.addClass('ui-datepicker-prev-hover');
1795
- if (elem.hasClass('ui-datepicker-next')) elem.addClass('ui-datepicker-next-hover');
1796
1794
  });
1797
1795
  }
1798
1796
 
@@ -1805,27 +1803,21 @@ function extendRemove(target, props) {
1805
1803
  return target;
1806
1804
  };
1807
1805
 
1808
- /* Determine whether an object is an array. */
1809
- function isArray(a) {
1810
- return (a && (($.browser.safari && typeof a == 'object' && a.length) ||
1811
- (a.constructor && a.constructor.toString().match(/\Array\(\)/))));
1812
- };
1813
-
1814
1806
  /* Invoke the datepicker functionality.
1815
1807
  @param options string - a command, optionally followed by additional parameters or
1816
- Object - settings for attaching new datepicker functionality
1808
+ Object - settings for attaching new datepicker functionality
1817
1809
  @return jQuery object */
1818
1810
  $.fn.datepicker = function(options){
1819
-
1811
+
1820
1812
  /* Verify an empty collection wasn't passed - Fixes #6976 */
1821
1813
  if ( !this.length ) {
1822
1814
  return this;
1823
1815
  }
1824
-
1816
+
1825
1817
  /* Initialise the date picker. */
1826
1818
  if (!$.datepicker.initialized) {
1827
1819
  $(document).mousedown($.datepicker._checkExternalClick).
1828
- find('body').append($.datepicker.dpDiv);
1820
+ find(document.body).append($.datepicker.dpDiv);
1829
1821
  $.datepicker.initialized = true;
1830
1822
  }
1831
1823
 
@@ -1847,7 +1839,7 @@ $.fn.datepicker = function(options){
1847
1839
  $.datepicker = new Datepicker(); // singleton instance
1848
1840
  $.datepicker.initialized = false;
1849
1841
  $.datepicker.uuid = new Date().getTime();
1850
- $.datepicker.version = "1.8.24";
1842
+ $.datepicker.version = "1.9.2";
1851
1843
 
1852
1844
  // Workaround for #4055
1853
1845
  // Add another global to avoid noConflict issues with inline event handlers
@@ -1,17 +1,19 @@
1
1
  //= require jquery.ui.core
2
2
  //= require jquery.ui.widget
3
- //= require jquery.ui.position
3
+ //= require jquery.ui.button
4
4
  //= require jquery.ui.draggable
5
+ //= require jquery.ui.position
5
6
  //= require jquery.ui.resizable
6
7
 
7
8
  /*!
8
- * jQuery UI Dialog 1.8.24
9
+ * jQuery UI Dialog 1.9.2
10
+ * http://jqueryui.com
9
11
  *
10
- * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
11
- * Dual licensed under the MIT or GPL Version 2 licenses.
12
+ * Copyright 2012 jQuery Foundation and other contributors
13
+ * Released under the MIT license.
12
14
  * http://jquery.org/license
13
15
  *
14
- * http://docs.jquery.com/UI/Dialog
16
+ * http://api.jqueryui.com/dialog/
15
17
  *
16
18
  * Depends:
17
19
  * jquery.ui.core.js
@@ -24,11 +26,7 @@
24
26
  */
25
27
  (function( $, undefined ) {
26
28
 
27
- var uiDialogClasses =
28
- 'ui-dialog ' +
29
- 'ui-widget ' +
30
- 'ui-widget-content ' +
31
- 'ui-corner-all ',
29
+ var uiDialogClasses = "ui-dialog ui-widget ui-widget-content ui-corner-all ",
32
30
  sizeRelatedOptions = {
33
31
  buttons: true,
34
32
  height: true,
@@ -46,158 +44,167 @@ var uiDialogClasses =
46
44
  };
47
45
 
48
46
  $.widget("ui.dialog", {
47
+ version: "1.9.2",
49
48
  options: {
50
49
  autoOpen: true,
51
50
  buttons: {},
52
51
  closeOnEscape: true,
53
- closeText: 'close',
54
- dialogClass: '',
52
+ closeText: "close",
53
+ dialogClass: "",
55
54
  draggable: true,
56
55
  hide: null,
57
- height: 'auto',
56
+ height: "auto",
58
57
  maxHeight: false,
59
58
  maxWidth: false,
60
59
  minHeight: 150,
61
60
  minWidth: 150,
62
61
  modal: false,
63
62
  position: {
64
- my: 'center',
65
- at: 'center',
66
- collision: 'fit',
63
+ my: "center",
64
+ at: "center",
65
+ of: window,
66
+ collision: "fit",
67
67
  // ensure that the titlebar is never outside the document
68
- using: function(pos) {
69
- var topOffset = $(this).css(pos).offset().top;
70
- if (topOffset < 0) {
71
- $(this).css('top', pos.top - topOffset);
68
+ using: function( pos ) {
69
+ var topOffset = $( this ).css( pos ).offset().top;
70
+ if ( topOffset < 0 ) {
71
+ $( this ).css( "top", pos.top - topOffset );
72
72
  }
73
73
  }
74
74
  },
75
75
  resizable: true,
76
76
  show: null,
77
77
  stack: true,
78
- title: '',
78
+ title: "",
79
79
  width: 300,
80
80
  zIndex: 1000
81
81
  },
82
82
 
83
83
  _create: function() {
84
- this.originalTitle = this.element.attr('title');
84
+ this.originalTitle = this.element.attr( "title" );
85
85
  // #5742 - .attr() might return a DOMElement
86
86
  if ( typeof this.originalTitle !== "string" ) {
87
87
  this.originalTitle = "";
88
88
  }
89
-
89
+ this.oldPosition = {
90
+ parent: this.element.parent(),
91
+ index: this.element.parent().children().index( this.element )
92
+ };
90
93
  this.options.title = this.options.title || this.originalTitle;
91
- var self = this,
92
- options = self.options,
93
-
94
- title = options.title || '&#160;',
95
- titleId = $.ui.dialog.getTitleId(self.element),
96
-
97
- uiDialog = (self.uiDialog = $('<div></div>'))
98
- .appendTo(document.body)
99
- .hide()
100
- .addClass(uiDialogClasses + options.dialogClass)
94
+ var that = this,
95
+ options = this.options,
96
+
97
+ title = options.title || "&#160;",
98
+ uiDialog,
99
+ uiDialogTitlebar,
100
+ uiDialogTitlebarClose,
101
+ uiDialogTitle,
102
+ uiDialogButtonPane;
103
+
104
+ uiDialog = ( this.uiDialog = $( "<div>" ) )
105
+ .addClass( uiDialogClasses + options.dialogClass )
101
106
  .css({
107
+ display: "none",
108
+ outline: 0, // TODO: move to stylesheet
102
109
  zIndex: options.zIndex
103
110
  })
104
111
  // setting tabIndex makes the div focusable
105
- // setting outline to 0 prevents a border on focus in Mozilla
106
- .attr('tabIndex', -1).css('outline', 0).keydown(function(event) {
107
- if (options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode &&
108
- event.keyCode === $.ui.keyCode.ESCAPE) {
109
-
110
- self.close(event);
112
+ .attr( "tabIndex", -1)
113
+ .keydown(function( event ) {
114
+ if ( options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode &&
115
+ event.keyCode === $.ui.keyCode.ESCAPE ) {
116
+ that.close( event );
111
117
  event.preventDefault();
112
118
  }
113
119
  })
114
- .attr({
115
- role: 'dialog',
116
- 'aria-labelledby': titleId
120
+ .mousedown(function( event ) {
121
+ that.moveToTop( false, event );
117
122
  })
118
- .mousedown(function(event) {
119
- self.moveToTop(false, event);
120
- }),
123
+ .appendTo( "body" );
121
124
 
122
- uiDialogContent = self.element
125
+ this.element
123
126
  .show()
124
- .removeAttr('title')
125
- .addClass(
126
- 'ui-dialog-content ' +
127
- 'ui-widget-content')
128
- .appendTo(uiDialog),
129
-
130
- uiDialogTitlebar = (self.uiDialogTitlebar = $('<div></div>'))
131
- .addClass(
132
- 'ui-dialog-titlebar ' +
133
- 'ui-widget-header ' +
134
- 'ui-corner-all ' +
135
- 'ui-helper-clearfix'
136
- )
137
- .prependTo(uiDialog),
138
-
139
- uiDialogTitlebarClose = $('<a href="#"></a>')
140
- .addClass(
141
- 'ui-dialog-titlebar-close ' +
142
- 'ui-corner-all'
143
- )
144
- .attr('role', 'button')
145
- .hover(
146
- function() {
147
- uiDialogTitlebarClose.addClass('ui-state-hover');
148
- },
149
- function() {
150
- uiDialogTitlebarClose.removeClass('ui-state-hover');
151
- }
152
- )
153
- .focus(function() {
154
- uiDialogTitlebarClose.addClass('ui-state-focus');
155
- })
156
- .blur(function() {
157
- uiDialogTitlebarClose.removeClass('ui-state-focus');
127
+ .removeAttr( "title" )
128
+ .addClass( "ui-dialog-content ui-widget-content" )
129
+ .appendTo( uiDialog );
130
+
131
+ uiDialogTitlebar = ( this.uiDialogTitlebar = $( "<div>" ) )
132
+ .addClass( "ui-dialog-titlebar ui-widget-header " +
133
+ "ui-corner-all ui-helper-clearfix" )
134
+ .bind( "mousedown", function() {
135
+ // Dialog isn't getting focus when dragging (#8063)
136
+ uiDialog.focus();
158
137
  })
159
- .click(function(event) {
160
- self.close(event);
161
- return false;
138
+ .prependTo( uiDialog );
139
+
140
+ uiDialogTitlebarClose = $( "<a href='#'></a>" )
141
+ .addClass( "ui-dialog-titlebar-close ui-corner-all" )
142
+ .attr( "role", "button" )
143
+ .click(function( event ) {
144
+ event.preventDefault();
145
+ that.close( event );
162
146
  })
163
- .appendTo(uiDialogTitlebar),
147
+ .appendTo( uiDialogTitlebar );
164
148
 
165
- uiDialogTitlebarCloseText = (self.uiDialogTitlebarCloseText = $('<span></span>'))
166
- .addClass(
167
- 'ui-icon ' +
168
- 'ui-icon-closethick'
169
- )
170
- .text(options.closeText)
171
- .appendTo(uiDialogTitlebarClose),
149
+ ( this.uiDialogTitlebarCloseText = $( "<span>" ) )
150
+ .addClass( "ui-icon ui-icon-closethick" )
151
+ .text( options.closeText )
152
+ .appendTo( uiDialogTitlebarClose );
172
153
 
173
- uiDialogTitle = $('<span></span>')
174
- .addClass('ui-dialog-title')
175
- .attr('id', titleId)
176
- .html(title)
177
- .prependTo(uiDialogTitlebar);
154
+ uiDialogTitle = $( "<span>" )
155
+ .uniqueId()
156
+ .addClass( "ui-dialog-title" )
157
+ .html( title )
158
+ .prependTo( uiDialogTitlebar );
178
159
 
179
- //handling of deprecated beforeclose (vs beforeClose) option
180
- //Ticket #4669 http://dev.jqueryui.com/ticket/4669
181
- //TODO: remove in 1.9pre
182
- if ($.isFunction(options.beforeclose) && !$.isFunction(options.beforeClose)) {
183
- options.beforeClose = options.beforeclose;
184
- }
160
+ uiDialogButtonPane = ( this.uiDialogButtonPane = $( "<div>" ) )
161
+ .addClass( "ui-dialog-buttonpane ui-widget-content ui-helper-clearfix" );
185
162
 
186
- uiDialogTitlebar.find("*").add(uiDialogTitlebar).disableSelection();
163
+ ( this.uiButtonSet = $( "<div>" ) )
164
+ .addClass( "ui-dialog-buttonset" )
165
+ .appendTo( uiDialogButtonPane );
166
+
167
+ uiDialog.attr({
168
+ role: "dialog",
169
+ "aria-labelledby": uiDialogTitle.attr( "id" )
170
+ });
171
+
172
+ uiDialogTitlebar.find( "*" ).add( uiDialogTitlebar ).disableSelection();
173
+ this._hoverable( uiDialogTitlebarClose );
174
+ this._focusable( uiDialogTitlebarClose );
187
175
 
188
- if (options.draggable && $.fn.draggable) {
189
- self._makeDraggable();
176
+ if ( options.draggable && $.fn.draggable ) {
177
+ this._makeDraggable();
190
178
  }
191
- if (options.resizable && $.fn.resizable) {
192
- self._makeResizable();
179
+ if ( options.resizable && $.fn.resizable ) {
180
+ this._makeResizable();
193
181
  }
194
182
 
195
- self._createButtons(options.buttons);
196
- self._isOpen = false;
183
+ this._createButtons( options.buttons );
184
+ this._isOpen = false;
197
185
 
198
- if ($.fn.bgiframe) {
186
+ if ( $.fn.bgiframe ) {
199
187
  uiDialog.bgiframe();
200
188
  }
189
+
190
+ // prevent tabbing out of modal dialogs
191
+ this._on( uiDialog, { keydown: function( event ) {
192
+ if ( !options.modal || event.keyCode !== $.ui.keyCode.TAB ) {
193
+ return;
194
+ }
195
+
196
+ var tabbables = $( ":tabbable", uiDialog ),
197
+ first = tabbables.filter( ":first" ),
198
+ last = tabbables.filter( ":last" );
199
+
200
+ if ( event.target === last[0] && !event.shiftKey ) {
201
+ first.focus( 1 );
202
+ return false;
203
+ } else if ( event.target === first[0] && event.shiftKey ) {
204
+ last.focus( 1 );
205
+ return false;
206
+ }
207
+ }});
201
208
  },
202
209
 
203
210
  _init: function() {
@@ -206,72 +213,81 @@ $.widget("ui.dialog", {
206
213
  }
207
214
  },
208
215
 
209
- destroy: function() {
210
- var self = this;
211
-
212
- if (self.overlay) {
213
- self.overlay.destroy();
216
+ _destroy: function() {
217
+ var next,
218
+ oldPosition = this.oldPosition;
219
+
220
+ if ( this.overlay ) {
221
+ this.overlay.destroy();
214
222
  }
215
- self.uiDialog.hide();
216
- self.element
217
- .unbind('.dialog')
218
- .removeData('dialog')
219
- .removeClass('ui-dialog-content ui-widget-content')
220
- .hide().appendTo('body');
221
- self.uiDialog.remove();
223
+ this.uiDialog.hide();
224
+ this.element
225
+ .removeClass( "ui-dialog-content ui-widget-content" )
226
+ .hide()
227
+ .appendTo( "body" );
228
+ this.uiDialog.remove();
222
229
 
223
- if (self.originalTitle) {
224
- self.element.attr('title', self.originalTitle);
230
+ if ( this.originalTitle ) {
231
+ this.element.attr( "title", this.originalTitle );
225
232
  }
226
233
 
227
- return self;
234
+ next = oldPosition.parent.children().eq( oldPosition.index );
235
+ // Don't try to place the dialog next to itself (#8613)
236
+ if ( next.length && next[ 0 ] !== this.element[ 0 ] ) {
237
+ next.before( this.element );
238
+ } else {
239
+ oldPosition.parent.append( this.element );
240
+ }
228
241
  },
229
242
 
230
243
  widget: function() {
231
244
  return this.uiDialog;
232
245
  },
233
246
 
234
- close: function(event) {
235
- var self = this,
247
+ close: function( event ) {
248
+ var that = this,
236
249
  maxZ, thisZ;
237
-
238
- if (false === self._trigger('beforeClose', event)) {
250
+
251
+ if ( !this._isOpen ) {
239
252
  return;
240
253
  }
241
254
 
242
- if (self.overlay) {
243
- self.overlay.destroy();
255
+ if ( false === this._trigger( "beforeClose", event ) ) {
256
+ return;
244
257
  }
245
- self.uiDialog.unbind('keypress.ui-dialog');
246
258
 
247
- self._isOpen = false;
259
+ this._isOpen = false;
260
+
261
+ if ( this.overlay ) {
262
+ this.overlay.destroy();
263
+ }
248
264
 
249
- if (self.options.hide) {
250
- self.uiDialog.hide(self.options.hide, function() {
251
- self._trigger('close', event);
265
+ if ( this.options.hide ) {
266
+ this._hide( this.uiDialog, this.options.hide, function() {
267
+ that._trigger( "close", event );
252
268
  });
253
269
  } else {
254
- self.uiDialog.hide();
255
- self._trigger('close', event);
270
+ this.uiDialog.hide();
271
+ this._trigger( "close", event );
256
272
  }
257
273
 
258
274
  $.ui.dialog.overlay.resize();
259
275
 
260
276
  // adjust the maxZ to allow other modal dialogs to continue to work (see #4309)
261
- if (self.options.modal) {
277
+ if ( this.options.modal ) {
262
278
  maxZ = 0;
263
- $('.ui-dialog').each(function() {
264
- if (this !== self.uiDialog[0]) {
265
- thisZ = $(this).css('z-index');
266
- if(!isNaN(thisZ)) {
267
- maxZ = Math.max(maxZ, thisZ);
279
+ $( ".ui-dialog" ).each(function() {
280
+ if ( this !== that.uiDialog[0] ) {
281
+ thisZ = $( this ).css( "z-index" );
282
+ if ( !isNaN( thisZ ) ) {
283
+ maxZ = Math.max( maxZ, thisZ );
268
284
  }
269
285
  }
270
286
  });
271
287
  $.ui.dialog.maxZ = maxZ;
272
288
  }
273
289
 
274
- return self;
290
+ return this;
275
291
  },
276
292
 
277
293
  isOpen: function() {
@@ -280,179 +296,158 @@ $.widget("ui.dialog", {
280
296
 
281
297
  // the force parameter allows us to move modal dialogs to their correct
282
298
  // position on open
283
- moveToTop: function(force, event) {
284
- var self = this,
285
- options = self.options,
299
+ moveToTop: function( force, event ) {
300
+ var options = this.options,
286
301
  saveScroll;
287
302
 
288
- if ((options.modal && !force) ||
289
- (!options.stack && !options.modal)) {
290
- return self._trigger('focus', event);
303
+ if ( ( options.modal && !force ) ||
304
+ ( !options.stack && !options.modal ) ) {
305
+ return this._trigger( "focus", event );
291
306
  }
292
307
 
293
- if (options.zIndex > $.ui.dialog.maxZ) {
308
+ if ( options.zIndex > $.ui.dialog.maxZ ) {
294
309
  $.ui.dialog.maxZ = options.zIndex;
295
310
  }
296
- if (self.overlay) {
311
+ if ( this.overlay ) {
297
312
  $.ui.dialog.maxZ += 1;
298
- self.overlay.$el.css('z-index', $.ui.dialog.overlay.maxZ = $.ui.dialog.maxZ);
313
+ $.ui.dialog.overlay.maxZ = $.ui.dialog.maxZ;
314
+ this.overlay.$el.css( "z-index", $.ui.dialog.overlay.maxZ );
299
315
  }
300
316
 
301
- //Save and then restore scroll since Opera 9.5+ resets when parent z-Index is changed.
302
- // http://ui.jquery.com/bugs/ticket/3193
303
- saveScroll = { scrollTop: self.element.scrollTop(), scrollLeft: self.element.scrollLeft() };
317
+ // Save and then restore scroll
318
+ // Opera 9.5+ resets when parent z-index is changed.
319
+ // http://bugs.jqueryui.com/ticket/3193
320
+ saveScroll = {
321
+ scrollTop: this.element.scrollTop(),
322
+ scrollLeft: this.element.scrollLeft()
323
+ };
304
324
  $.ui.dialog.maxZ += 1;
305
- self.uiDialog.css('z-index', $.ui.dialog.maxZ);
306
- self.element.attr(saveScroll);
307
- self._trigger('focus', event);
325
+ this.uiDialog.css( "z-index", $.ui.dialog.maxZ );
326
+ this.element.attr( saveScroll );
327
+ this._trigger( "focus", event );
308
328
 
309
- return self;
329
+ return this;
310
330
  },
311
331
 
312
332
  open: function() {
313
- if (this._isOpen) { return; }
314
-
315
- var self = this,
316
- options = self.options,
317
- uiDialog = self.uiDialog;
318
-
319
- self.overlay = options.modal ? new $.ui.dialog.overlay(self) : null;
320
- self._size();
321
- self._position(options.position);
322
- uiDialog.show(options.show);
323
- self.moveToTop(true);
324
-
325
- // prevent tabbing out of modal dialogs
326
- if ( options.modal ) {
327
- uiDialog.bind( "keydown.ui-dialog", function( event ) {
328
- if ( event.keyCode !== $.ui.keyCode.TAB ) {
329
- return;
330
- }
333
+ if ( this._isOpen ) {
334
+ return;
335
+ }
331
336
 
332
- var tabbables = $(':tabbable', this),
333
- first = tabbables.filter(':first'),
334
- last = tabbables.filter(':last');
337
+ var hasFocus,
338
+ options = this.options,
339
+ uiDialog = this.uiDialog;
335
340
 
336
- if (event.target === last[0] && !event.shiftKey) {
337
- first.focus(1);
338
- return false;
339
- } else if (event.target === first[0] && event.shiftKey) {
340
- last.focus(1);
341
- return false;
342
- }
343
- });
344
- }
341
+ this._size();
342
+ this._position( options.position );
343
+ uiDialog.show( options.show );
344
+ this.overlay = options.modal ? new $.ui.dialog.overlay( this ) : null;
345
+ this.moveToTop( true );
345
346
 
346
347
  // set focus to the first tabbable element in the content area or the first button
347
348
  // if there are no tabbable elements, set focus on the dialog itself
348
- $(self.element.find(':tabbable').get().concat(
349
- uiDialog.find('.ui-dialog-buttonpane :tabbable').get().concat(
350
- uiDialog.get()))).eq(0).focus();
349
+ hasFocus = this.element.find( ":tabbable" );
350
+ if ( !hasFocus.length ) {
351
+ hasFocus = this.uiDialogButtonPane.find( ":tabbable" );
352
+ if ( !hasFocus.length ) {
353
+ hasFocus = uiDialog;
354
+ }
355
+ }
356
+ hasFocus.eq( 0 ).focus();
351
357
 
352
- self._isOpen = true;
353
- self._trigger('open');
358
+ this._isOpen = true;
359
+ this._trigger( "open" );
354
360
 
355
- return self;
361
+ return this;
356
362
  },
357
363
 
358
- _createButtons: function(buttons) {
359
- var self = this,
360
- hasButtons = false,
361
- uiDialogButtonPane = $('<div></div>')
362
- .addClass(
363
- 'ui-dialog-buttonpane ' +
364
- 'ui-widget-content ' +
365
- 'ui-helper-clearfix'
366
- ),
367
- uiButtonSet = $( "<div></div>" )
368
- .addClass( "ui-dialog-buttonset" )
369
- .appendTo( uiDialogButtonPane );
364
+ _createButtons: function( buttons ) {
365
+ var that = this,
366
+ hasButtons = false;
370
367
 
371
368
  // if we already have a button pane, remove it
372
- self.uiDialog.find('.ui-dialog-buttonpane').remove();
369
+ this.uiDialogButtonPane.remove();
370
+ this.uiButtonSet.empty();
373
371
 
374
- if (typeof buttons === 'object' && buttons !== null) {
375
- $.each(buttons, function() {
372
+ if ( typeof buttons === "object" && buttons !== null ) {
373
+ $.each( buttons, function() {
376
374
  return !(hasButtons = true);
377
375
  });
378
376
  }
379
- if (hasButtons) {
380
- $.each(buttons, function(name, props) {
377
+ if ( hasButtons ) {
378
+ $.each( buttons, function( name, props ) {
379
+ var button, click;
381
380
  props = $.isFunction( props ) ?
382
381
  { click: props, text: name } :
383
382
  props;
384
- var button = $('<button type="button"></button>')
385
- .click(function() {
386
- props.click.apply(self.element[0], arguments);
387
- })
388
- .appendTo(uiButtonSet);
389
- // can't use .attr( props, true ) with jQuery 1.3.2.
390
- $.each( props, function( key, value ) {
391
- if ( key === "click" ) {
392
- return;
393
- }
394
- if ( key in button ) {
395
- button[ key ]( value );
396
- } else {
397
- button.attr( key, value );
398
- }
399
- });
400
- if ($.fn.button) {
383
+ // Default to a non-submitting button
384
+ props = $.extend( { type: "button" }, props );
385
+ // Change the context for the click callback to be the main element
386
+ click = props.click;
387
+ props.click = function() {
388
+ click.apply( that.element[0], arguments );
389
+ };
390
+ button = $( "<button></button>", props )
391
+ .appendTo( that.uiButtonSet );
392
+ if ( $.fn.button ) {
401
393
  button.button();
402
394
  }
403
395
  });
404
- uiDialogButtonPane.appendTo(self.uiDialog);
396
+ this.uiDialog.addClass( "ui-dialog-buttons" );
397
+ this.uiDialogButtonPane.appendTo( this.uiDialog );
398
+ } else {
399
+ this.uiDialog.removeClass( "ui-dialog-buttons" );
405
400
  }
406
401
  },
407
402
 
408
403
  _makeDraggable: function() {
409
- var self = this,
410
- options = self.options,
411
- doc = $(document),
412
- heightBeforeDrag;
404
+ var that = this,
405
+ options = this.options;
413
406
 
414
- function filteredUi(ui) {
407
+ function filteredUi( ui ) {
415
408
  return {
416
409
  position: ui.position,
417
410
  offset: ui.offset
418
411
  };
419
412
  }
420
413
 
421
- self.uiDialog.draggable({
422
- cancel: '.ui-dialog-content, .ui-dialog-titlebar-close',
423
- handle: '.ui-dialog-titlebar',
424
- containment: 'document',
425
- start: function(event, ui) {
426
- heightBeforeDrag = options.height === "auto" ? "auto" : $(this).height();
427
- $(this).height($(this).height()).addClass("ui-dialog-dragging");
428
- self._trigger('dragStart', event, filteredUi(ui));
414
+ this.uiDialog.draggable({
415
+ cancel: ".ui-dialog-content, .ui-dialog-titlebar-close",
416
+ handle: ".ui-dialog-titlebar",
417
+ containment: "document",
418
+ start: function( event, ui ) {
419
+ $( this )
420
+ .addClass( "ui-dialog-dragging" );
421
+ that._trigger( "dragStart", event, filteredUi( ui ) );
429
422
  },
430
- drag: function(event, ui) {
431
- self._trigger('drag', event, filteredUi(ui));
423
+ drag: function( event, ui ) {
424
+ that._trigger( "drag", event, filteredUi( ui ) );
432
425
  },
433
- stop: function(event, ui) {
434
- options.position = [ui.position.left - doc.scrollLeft(),
435
- ui.position.top - doc.scrollTop()];
436
- $(this).removeClass("ui-dialog-dragging").height(heightBeforeDrag);
437
- self._trigger('dragStop', event, filteredUi(ui));
426
+ stop: function( event, ui ) {
427
+ options.position = [
428
+ ui.position.left - that.document.scrollLeft(),
429
+ ui.position.top - that.document.scrollTop()
430
+ ];
431
+ $( this )
432
+ .removeClass( "ui-dialog-dragging" );
433
+ that._trigger( "dragStop", event, filteredUi( ui ) );
438
434
  $.ui.dialog.overlay.resize();
439
435
  }
440
436
  });
441
437
  },
442
438
 
443
- _makeResizable: function(handles) {
439
+ _makeResizable: function( handles ) {
444
440
  handles = (handles === undefined ? this.options.resizable : handles);
445
- var self = this,
446
- options = self.options,
441
+ var that = this,
442
+ options = this.options,
447
443
  // .ui-resizable has position: relative defined in the stylesheet
448
444
  // but dialogs have to use absolute or fixed positioning
449
- position = self.uiDialog.css('position'),
450
- resizeHandles = (typeof handles === 'string' ?
445
+ position = this.uiDialog.css( "position" ),
446
+ resizeHandles = typeof handles === 'string' ?
451
447
  handles :
452
- 'n,e,s,w,se,sw,ne,nw'
453
- );
448
+ "n,e,s,w,se,sw,ne,nw";
454
449
 
455
- function filteredUi(ui) {
450
+ function filteredUi( ui ) {
456
451
  return {
457
452
  originalPosition: ui.originalPosition,
458
453
  originalSize: ui.originalSize,
@@ -461,101 +456,99 @@ $.widget("ui.dialog", {
461
456
  };
462
457
  }
463
458
 
464
- self.uiDialog.resizable({
465
- cancel: '.ui-dialog-content',
466
- containment: 'document',
467
- alsoResize: self.element,
459
+ this.uiDialog.resizable({
460
+ cancel: ".ui-dialog-content",
461
+ containment: "document",
462
+ alsoResize: this.element,
468
463
  maxWidth: options.maxWidth,
469
464
  maxHeight: options.maxHeight,
470
465
  minWidth: options.minWidth,
471
- minHeight: self._minHeight(),
466
+ minHeight: this._minHeight(),
472
467
  handles: resizeHandles,
473
- start: function(event, ui) {
474
- $(this).addClass("ui-dialog-resizing");
475
- self._trigger('resizeStart', event, filteredUi(ui));
468
+ start: function( event, ui ) {
469
+ $( this ).addClass( "ui-dialog-resizing" );
470
+ that._trigger( "resizeStart", event, filteredUi( ui ) );
476
471
  },
477
- resize: function(event, ui) {
478
- self._trigger('resize', event, filteredUi(ui));
472
+ resize: function( event, ui ) {
473
+ that._trigger( "resize", event, filteredUi( ui ) );
479
474
  },
480
- stop: function(event, ui) {
481
- $(this).removeClass("ui-dialog-resizing");
482
- options.height = $(this).height();
483
- options.width = $(this).width();
484
- self._trigger('resizeStop', event, filteredUi(ui));
475
+ stop: function( event, ui ) {
476
+ $( this ).removeClass( "ui-dialog-resizing" );
477
+ options.height = $( this ).height();
478
+ options.width = $( this ).width();
479
+ that._trigger( "resizeStop", event, filteredUi( ui ) );
485
480
  $.ui.dialog.overlay.resize();
486
481
  }
487
482
  })
488
- .css('position', position)
489
- .find('.ui-resizable-se').addClass('ui-icon ui-icon-grip-diagonal-se');
483
+ .css( "position", position )
484
+ .find( ".ui-resizable-se" )
485
+ .addClass( "ui-icon ui-icon-grip-diagonal-se" );
490
486
  },
491
487
 
492
488
  _minHeight: function() {
493
489
  var options = this.options;
494
490
 
495
- if (options.height === 'auto') {
491
+ if ( options.height === "auto" ) {
496
492
  return options.minHeight;
497
493
  } else {
498
- return Math.min(options.minHeight, options.height);
494
+ return Math.min( options.minHeight, options.height );
499
495
  }
500
496
  },
501
497
 
502
- _position: function(position) {
498
+ _position: function( position ) {
503
499
  var myAt = [],
504
- offset = [0, 0],
500
+ offset = [ 0, 0 ],
505
501
  isVisible;
506
502
 
507
- if (position) {
503
+ if ( position ) {
508
504
  // deep extending converts arrays to objects in jQuery <= 1.3.2 :-(
509
505
  // if (typeof position == 'string' || $.isArray(position)) {
510
506
  // myAt = $.isArray(position) ? position : position.split(' ');
511
507
 
512
- if (typeof position === 'string' || (typeof position === 'object' && '0' in position)) {
513
- myAt = position.split ? position.split(' ') : [position[0], position[1]];
514
- if (myAt.length === 1) {
515
- myAt[1] = myAt[0];
508
+ if ( typeof position === "string" || (typeof position === "object" && "0" in position ) ) {
509
+ myAt = position.split ? position.split( " " ) : [ position[ 0 ], position[ 1 ] ];
510
+ if ( myAt.length === 1 ) {
511
+ myAt[ 1 ] = myAt[ 0 ];
516
512
  }
517
513
 
518
- $.each(['left', 'top'], function(i, offsetPosition) {
519
- if (+myAt[i] === myAt[i]) {
520
- offset[i] = myAt[i];
521
- myAt[i] = offsetPosition;
514
+ $.each( [ "left", "top" ], function( i, offsetPosition ) {
515
+ if ( +myAt[ i ] === myAt[ i ] ) {
516
+ offset[ i ] = myAt[ i ];
517
+ myAt[ i ] = offsetPosition;
522
518
  }
523
519
  });
524
520
 
525
521
  position = {
526
- my: myAt.join(" "),
527
- at: myAt.join(" "),
528
- offset: offset.join(" ")
522
+ my: myAt[0] + (offset[0] < 0 ? offset[0] : "+" + offset[0]) + " " +
523
+ myAt[1] + (offset[1] < 0 ? offset[1] : "+" + offset[1]),
524
+ at: myAt.join( " " )
529
525
  };
530
- }
526
+ }
531
527
 
532
- position = $.extend({}, $.ui.dialog.prototype.options.position, position);
528
+ position = $.extend( {}, $.ui.dialog.prototype.options.position, position );
533
529
  } else {
534
530
  position = $.ui.dialog.prototype.options.position;
535
531
  }
536
532
 
537
533
  // need to show the dialog to get the actual offset in the position plugin
538
- isVisible = this.uiDialog.is(':visible');
539
- if (!isVisible) {
534
+ isVisible = this.uiDialog.is( ":visible" );
535
+ if ( !isVisible ) {
540
536
  this.uiDialog.show();
541
537
  }
542
- this.uiDialog
543
- // workaround for jQuery bug #5781 http://dev.jquery.com/ticket/5781
544
- .css({ top: 0, left: 0 })
545
- .position($.extend({ of: window }, position));
546
- if (!isVisible) {
538
+ this.uiDialog.position( position );
539
+ if ( !isVisible ) {
547
540
  this.uiDialog.hide();
548
541
  }
549
542
  },
550
543
 
551
544
  _setOptions: function( options ) {
552
- var self = this,
545
+ var that = this,
553
546
  resizableOptions = {},
554
547
  resize = false;
555
548
 
556
549
  $.each( options, function( key, value ) {
557
- self._setOption( key, value );
558
-
550
+ that._setOption( key, value );
551
+
559
552
  if ( key in sizeRelatedOptions ) {
560
553
  resize = true;
561
554
  }
@@ -572,104 +565,98 @@ $.widget("ui.dialog", {
572
565
  }
573
566
  },
574
567
 
575
- _setOption: function(key, value){
576
- var self = this,
577
- uiDialog = self.uiDialog;
568
+ _setOption: function( key, value ) {
569
+ var isDraggable, isResizable,
570
+ uiDialog = this.uiDialog;
578
571
 
579
- switch (key) {
580
- //handling of deprecated beforeclose (vs beforeClose) option
581
- //Ticket #4669 http://dev.jqueryui.com/ticket/4669
582
- //TODO: remove in 1.9pre
583
- case "beforeclose":
584
- key = "beforeClose";
585
- break;
572
+ switch ( key ) {
586
573
  case "buttons":
587
- self._createButtons(value);
574
+ this._createButtons( value );
588
575
  break;
589
576
  case "closeText":
590
577
  // ensure that we always pass a string
591
- self.uiDialogTitlebarCloseText.text("" + value);
578
+ this.uiDialogTitlebarCloseText.text( "" + value );
592
579
  break;
593
580
  case "dialogClass":
594
581
  uiDialog
595
- .removeClass(self.options.dialogClass)
596
- .addClass(uiDialogClasses + value);
582
+ .removeClass( this.options.dialogClass )
583
+ .addClass( uiDialogClasses + value );
597
584
  break;
598
585
  case "disabled":
599
- if (value) {
600
- uiDialog.addClass('ui-dialog-disabled');
586
+ if ( value ) {
587
+ uiDialog.addClass( "ui-dialog-disabled" );
601
588
  } else {
602
- uiDialog.removeClass('ui-dialog-disabled');
589
+ uiDialog.removeClass( "ui-dialog-disabled" );
603
590
  }
604
591
  break;
605
592
  case "draggable":
606
- var isDraggable = uiDialog.is( ":data(draggable)" );
593
+ isDraggable = uiDialog.is( ":data(draggable)" );
607
594
  if ( isDraggable && !value ) {
608
595
  uiDialog.draggable( "destroy" );
609
596
  }
610
-
597
+
611
598
  if ( !isDraggable && value ) {
612
- self._makeDraggable();
599
+ this._makeDraggable();
613
600
  }
614
601
  break;
615
602
  case "position":
616
- self._position(value);
603
+ this._position( value );
617
604
  break;
618
605
  case "resizable":
619
606
  // currently resizable, becoming non-resizable
620
- var isResizable = uiDialog.is( ":data(resizable)" );
621
- if (isResizable && !value) {
622
- uiDialog.resizable('destroy');
607
+ isResizable = uiDialog.is( ":data(resizable)" );
608
+ if ( isResizable && !value ) {
609
+ uiDialog.resizable( "destroy" );
623
610
  }
624
611
 
625
612
  // currently resizable, changing handles
626
- if (isResizable && typeof value === 'string') {
627
- uiDialog.resizable('option', 'handles', value);
613
+ if ( isResizable && typeof value === "string" ) {
614
+ uiDialog.resizable( "option", "handles", value );
628
615
  }
629
616
 
630
617
  // currently non-resizable, becoming resizable
631
- if (!isResizable && value !== false) {
632
- self._makeResizable(value);
618
+ if ( !isResizable && value !== false ) {
619
+ this._makeResizable( value );
633
620
  }
634
621
  break;
635
622
  case "title":
636
623
  // convert whatever was passed in o a string, for html() to not throw up
637
- $(".ui-dialog-title", self.uiDialogTitlebar).html("" + (value || '&#160;'));
624
+ $( ".ui-dialog-title", this.uiDialogTitlebar )
625
+ .html( "" + ( value || "&#160;" ) );
638
626
  break;
639
627
  }
640
628
 
641
- $.Widget.prototype._setOption.apply(self, arguments);
629
+ this._super( key, value );
642
630
  },
643
631
 
644
632
  _size: function() {
645
633
  /* If the user has resized the dialog, the .ui-dialog and .ui-dialog-content
646
634
  * divs will both have width and height set, so we need to reset them
647
635
  */
648
- var options = this.options,
649
- nonContentHeight,
650
- minContentHeight,
636
+ var nonContentHeight, minContentHeight, autoHeight,
637
+ options = this.options,
651
638
  isVisible = this.uiDialog.is( ":visible" );
652
639
 
653
640
  // reset content sizing
654
641
  this.element.show().css({
655
- width: 'auto',
642
+ width: "auto",
656
643
  minHeight: 0,
657
644
  height: 0
658
645
  });
659
646
 
660
- if (options.minWidth > options.width) {
647
+ if ( options.minWidth > options.width ) {
661
648
  options.width = options.minWidth;
662
649
  }
663
650
 
664
651
  // reset wrapper sizing
665
652
  // determine the height of all the non-content elements
666
653
  nonContentHeight = this.uiDialog.css({
667
- height: 'auto',
654
+ height: "auto",
668
655
  width: options.width
669
656
  })
670
- .height();
657
+ .outerHeight();
671
658
  minContentHeight = Math.max( 0, options.minHeight - nonContentHeight );
672
-
659
+
673
660
  if ( options.height === "auto" ) {
674
661
  // only needed for IE6 support
675
662
  if ( $.support.minHeight ) {
@@ -679,7 +666,7 @@ $.widget("ui.dialog", {
679
666
  });
680
667
  } else {
681
668
  this.uiDialog.show();
682
- var autoHeight = this.element.css( "height", "auto" ).height();
669
+ autoHeight = this.element.css( "height", "auto" ).height();
683
670
  if ( !isVisible ) {
684
671
  this.uiDialog.hide();
685
672
  }
@@ -689,102 +676,108 @@ $.widget("ui.dialog", {
689
676
  this.element.height( Math.max( options.height - nonContentHeight, 0 ) );
690
677
  }
691
678
 
692
- if (this.uiDialog.is(':data(resizable)')) {
693
- this.uiDialog.resizable('option', 'minHeight', this._minHeight());
679
+ if (this.uiDialog.is( ":data(resizable)" ) ) {
680
+ this.uiDialog.resizable( "option", "minHeight", this._minHeight() );
694
681
  }
695
682
  }
696
683
  });
697
684
 
698
685
  $.extend($.ui.dialog, {
699
- version: "1.8.24",
700
-
701
686
  uuid: 0,
702
687
  maxZ: 0,
703
688
 
704
689
  getTitleId: function($el) {
705
- var id = $el.attr('id');
706
- if (!id) {
690
+ var id = $el.attr( "id" );
691
+ if ( !id ) {
707
692
  this.uuid += 1;
708
693
  id = this.uuid;
709
694
  }
710
- return 'ui-dialog-title-' + id;
695
+ return "ui-dialog-title-" + id;
711
696
  },
712
697
 
713
- overlay: function(dialog) {
714
- this.$el = $.ui.dialog.overlay.create(dialog);
698
+ overlay: function( dialog ) {
699
+ this.$el = $.ui.dialog.overlay.create( dialog );
715
700
  }
716
701
  });
717
702
 
718
- $.extend($.ui.dialog.overlay, {
703
+ $.extend( $.ui.dialog.overlay, {
719
704
  instances: [],
720
705
  // reuse old instances due to IE memory leak with alpha transparency (see #5185)
721
706
  oldInstances: [],
722
707
  maxZ: 0,
723
- events: $.map('focus,mousedown,mouseup,keydown,keypress,click'.split(','),
724
- function(event) { return event + '.dialog-overlay'; }).join(' '),
725
- create: function(dialog) {
726
- if (this.instances.length === 0) {
708
+ events: $.map(
709
+ "focus,mousedown,mouseup,keydown,keypress,click".split( "," ),
710
+ function( event ) {
711
+ return event + ".dialog-overlay";
712
+ }
713
+ ).join( " " ),
714
+ create: function( dialog ) {
715
+ if ( this.instances.length === 0 ) {
727
716
  // prevent use of anchors and inputs
728
717
  // we use a setTimeout in case the overlay is created from an
729
718
  // event that we're going to be cancelling (see #2804)
730
719
  setTimeout(function() {
731
720
  // handle $(el).dialog().dialog('close') (see #4065)
732
- if ($.ui.dialog.overlay.instances.length) {
733
- $(document).bind($.ui.dialog.overlay.events, function(event) {
721
+ if ( $.ui.dialog.overlay.instances.length ) {
722
+ $( document ).bind( $.ui.dialog.overlay.events, function( event ) {
734
723
  // stop events if the z-index of the target is < the z-index of the overlay
735
724
  // we cannot return true when we don't want to cancel the event (#3523)
736
- if ($(event.target).zIndex() < $.ui.dialog.overlay.maxZ) {
725
+ if ( $( event.target ).zIndex() < $.ui.dialog.overlay.maxZ ) {
737
726
  return false;
738
727
  }
739
728
  });
740
729
  }
741
- }, 1);
742
-
743
- // allow closing by pressing the escape key
744
- $(document).bind('keydown.dialog-overlay', function(event) {
745
- if (dialog.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode &&
746
- event.keyCode === $.ui.keyCode.ESCAPE) {
747
-
748
- dialog.close(event);
749
- event.preventDefault();
750
- }
751
- });
730
+ }, 1 );
752
731
 
753
732
  // handle window resize
754
- $(window).bind('resize.dialog-overlay', $.ui.dialog.overlay.resize);
733
+ $( window ).bind( "resize.dialog-overlay", $.ui.dialog.overlay.resize );
755
734
  }
756
735
 
757
- var $el = (this.oldInstances.pop() || $('<div></div>').addClass('ui-widget-overlay'))
758
- .appendTo(document.body)
759
- .css({
760
- width: this.width(),
761
- height: this.height()
762
- });
736
+ var $el = ( this.oldInstances.pop() || $( "<div>" ).addClass( "ui-widget-overlay" ) );
737
+
738
+ // allow closing by pressing the escape key
739
+ $( document ).bind( "keydown.dialog-overlay", function( event ) {
740
+ var instances = $.ui.dialog.overlay.instances;
741
+ // only react to the event if we're the top overlay
742
+ if ( instances.length !== 0 && instances[ instances.length - 1 ] === $el &&
743
+ dialog.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode &&
744
+ event.keyCode === $.ui.keyCode.ESCAPE ) {
763
745
 
764
- if ($.fn.bgiframe) {
746
+ dialog.close( event );
747
+ event.preventDefault();
748
+ }
749
+ });
750
+
751
+ $el.appendTo( document.body ).css({
752
+ width: this.width(),
753
+ height: this.height()
754
+ });
755
+
756
+ if ( $.fn.bgiframe ) {
765
757
  $el.bgiframe();
766
758
  }
767
759
 
768
- this.instances.push($el);
760
+ this.instances.push( $el );
769
761
  return $el;
770
762
  },
771
763
 
772
- destroy: function($el) {
773
- var indexOf = $.inArray($el, this.instances);
774
- if (indexOf != -1){
775
- this.oldInstances.push(this.instances.splice(indexOf, 1)[0]);
764
+ destroy: function( $el ) {
765
+ var indexOf = $.inArray( $el, this.instances ),
766
+ maxZ = 0;
767
+
768
+ if ( indexOf !== -1 ) {
769
+ this.oldInstances.push( this.instances.splice( indexOf, 1 )[ 0 ] );
776
770
  }
777
771
 
778
- if (this.instances.length === 0) {
779
- $([document, window]).unbind('.dialog-overlay');
772
+ if ( this.instances.length === 0 ) {
773
+ $( [ document, window ] ).unbind( ".dialog-overlay" );
780
774
  }
781
775
 
782
- $el.remove();
783
-
776
+ $el.height( 0 ).width( 0 ).remove();
777
+
784
778
  // adjust the maxZ to allow other modal dialogs to continue to work (see #4309)
785
- var maxZ = 0;
786
- $.each(this.instances, function() {
787
- maxZ = Math.max(maxZ, this.css('z-index'));
779
+ $.each( this.instances, function() {
780
+ maxZ = Math.max( maxZ, this.css( "z-index" ) );
788
781
  });
789
782
  this.maxZ = maxZ;
790
783
  },
@@ -792,8 +785,8 @@ $.extend($.ui.dialog.overlay, {
792
785
  height: function() {
793
786
  var scrollHeight,
794
787
  offsetHeight;
795
- // handle IE 6
796
- if ($.browser.msie && $.browser.version < 7) {
788
+ // handle IE
789
+ if ( $.ui.ie ) {
797
790
  scrollHeight = Math.max(
798
791
  document.documentElement.scrollHeight,
799
792
  document.body.scrollHeight
@@ -803,14 +796,14 @@ $.extend($.ui.dialog.overlay, {
803
796
  document.body.offsetHeight
804
797
  );
805
798
 
806
- if (scrollHeight < offsetHeight) {
807
- return $(window).height() + 'px';
799
+ if ( scrollHeight < offsetHeight ) {
800
+ return $( window ).height() + "px";
808
801
  } else {
809
- return scrollHeight + 'px';
802
+ return scrollHeight + "px";
810
803
  }
811
804
  // handle "good" browsers
812
805
  } else {
813
- return $(document).height() + 'px';
806
+ return $( document ).height() + "px";
814
807
  }
815
808
  },
816
809
 
@@ -818,7 +811,7 @@ $.extend($.ui.dialog.overlay, {
818
811
  var scrollWidth,
819
812
  offsetWidth;
820
813
  // handle IE
821
- if ( $.browser.msie ) {
814
+ if ( $.ui.ie ) {
822
815
  scrollWidth = Math.max(
823
816
  document.documentElement.scrollWidth,
824
817
  document.body.scrollWidth
@@ -828,14 +821,14 @@ $.extend($.ui.dialog.overlay, {
828
821
  document.body.offsetWidth
829
822
  );
830
823
 
831
- if (scrollWidth < offsetWidth) {
832
- return $(window).width() + 'px';
824
+ if ( scrollWidth < offsetWidth ) {
825
+ return $( window ).width() + "px";
833
826
  } else {
834
- return scrollWidth + 'px';
827
+ return scrollWidth + "px";
835
828
  }
836
829
  // handle "good" browsers
837
830
  } else {
838
- return $(document).width() + 'px';
831
+ return $( document ).width() + "px";
839
832
  }
840
833
  },
841
834
 
@@ -848,9 +841,9 @@ $.extend($.ui.dialog.overlay, {
848
841
  * This is handled by shrinking the overlay before setting it
849
842
  * to the full document size.
850
843
  */
851
- var $overlays = $([]);
852
- $.each($.ui.dialog.overlay.instances, function() {
853
- $overlays = $overlays.add(this);
844
+ var $overlays = $( [] );
845
+ $.each( $.ui.dialog.overlay.instances, function() {
846
+ $overlays = $overlays.add( this );
854
847
  });
855
848
 
856
849
  $overlays.css({
@@ -863,10 +856,10 @@ $.extend($.ui.dialog.overlay, {
863
856
  }
864
857
  });
865
858
 
866
- $.extend($.ui.dialog.overlay.prototype, {
859
+ $.extend( $.ui.dialog.overlay.prototype, {
867
860
  destroy: function() {
868
- $.ui.dialog.overlay.destroy(this.$el);
861
+ $.ui.dialog.overlay.destroy( this.$el );
869
862
  }
870
863
  });
871
864
 
872
- }(jQuery));
865
+ }( jQuery ) );