jquery-ui-rails 4.0.0 → 4.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


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

Files changed (149) hide show
  1. data/.travis.yml +0 -1
  2. data/Gemfile +1 -1
  3. data/History.md +44 -0
  4. data/README.md +16 -4
  5. data/Rakefile +39 -11
  6. data/VERSIONS.md +31 -0
  7. data/app/assets/images/jquery-ui/animated-overlay.gif +0 -0
  8. data/{vendor → app}/assets/images/jquery-ui/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  9. data/{vendor → app}/assets/images/jquery-ui/ui-bg_flat_75_ffffff_40x100.png +0 -0
  10. data/{vendor → app}/assets/images/jquery-ui/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  11. data/{vendor → app}/assets/images/jquery-ui/ui-bg_glass_65_ffffff_1x400.png +0 -0
  12. data/{vendor → app}/assets/images/jquery-ui/ui-bg_glass_75_dadada_1x400.png +0 -0
  13. data/{vendor → app}/assets/images/jquery-ui/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  14. data/{vendor → app}/assets/images/jquery-ui/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  15. data/{vendor → app}/assets/images/jquery-ui/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  16. data/{vendor → app}/assets/images/jquery-ui/ui-icons_222222_256x240.png +0 -0
  17. data/{vendor → app}/assets/images/jquery-ui/ui-icons_2e83ff_256x240.png +0 -0
  18. data/{vendor → app}/assets/images/jquery-ui/ui-icons_454545_256x240.png +0 -0
  19. data/{vendor → app}/assets/images/jquery-ui/ui-icons_888888_256x240.png +0 -0
  20. data/{vendor → app}/assets/images/jquery-ui/ui-icons_cd0a0a_256x240.png +0 -0
  21. data/{vendor → app}/assets/javascripts/jquery.ui.accordion.js +17 -18
  22. data/{vendor → app}/assets/javascripts/jquery.ui.all.js +0 -0
  23. data/{vendor → app}/assets/javascripts/jquery.ui.autocomplete.js +36 -44
  24. data/{vendor → app}/assets/javascripts/jquery.ui.button.js +23 -47
  25. data/{vendor → app}/assets/javascripts/jquery.ui.core.js +20 -24
  26. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-af.js +0 -0
  27. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-ar-DZ.js +0 -0
  28. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-ar.js +0 -0
  29. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-az.js +0 -0
  30. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-be.js +0 -0
  31. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-bg.js +0 -0
  32. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-bs.js +0 -0
  33. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-ca.js +0 -0
  34. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-cs.js +0 -0
  35. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-cy-GB.js +0 -0
  36. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-da.js +0 -0
  37. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-de.js +3 -3
  38. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-el.js +0 -0
  39. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-en-AU.js +0 -0
  40. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-en-GB.js +0 -0
  41. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-en-NZ.js +0 -0
  42. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-eo.js +0 -0
  43. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-es.js +7 -7
  44. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-et.js +0 -0
  45. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-eu.js +0 -0
  46. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-fa.js +0 -0
  47. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-fi.js +1 -1
  48. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-fo.js +0 -0
  49. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-fr-CA.js +0 -0
  50. data/app/assets/javascripts/jquery.ui.datepicker-fr-CH.js +23 -0
  51. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-fr.js +6 -6
  52. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-gl.js +0 -0
  53. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-he.js +0 -0
  54. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-hi.js +0 -0
  55. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-hr.js +0 -0
  56. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-hu.js +0 -0
  57. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-hy.js +0 -0
  58. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-id.js +0 -0
  59. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-is.js +1 -1
  60. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-it.js +0 -0
  61. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-ja.js +0 -0
  62. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-ka.js +0 -0
  63. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-kk.js +0 -0
  64. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-km.js +0 -0
  65. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-ko.js +0 -0
  66. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-ky.js +0 -0
  67. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-lb.js +0 -0
  68. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-lt.js +2 -2
  69. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-lv.js +4 -4
  70. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-mk.js +0 -0
  71. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-ml.js +0 -0
  72. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-ms.js +0 -0
  73. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-nb.js +0 -0
  74. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-nl-BE.js +0 -0
  75. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-nl.js +0 -0
  76. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-nn.js +0 -0
  77. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-no.js +0 -0
  78. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-pl.js +0 -0
  79. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-pt-BR.js +0 -0
  80. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-pt.js +1 -1
  81. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-rm.js +0 -0
  82. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-ro.js +0 -0
  83. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-ru.js +0 -0
  84. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-sk.js +3 -3
  85. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-sl.js +0 -0
  86. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-sq.js +0 -0
  87. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-sr-SR.js +1 -1
  88. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-sr.js +1 -1
  89. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-sv.js +0 -0
  90. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-ta.js +0 -0
  91. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-th.js +0 -0
  92. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-tj.js +0 -0
  93. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-tr.js +0 -0
  94. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-uk.js +0 -0
  95. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-vi.js +0 -0
  96. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-zh-CN.js +0 -0
  97. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-zh-HK.js +0 -0
  98. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker-zh-TW.js +0 -0
  99. data/{vendor → app}/assets/javascripts/jquery.ui.datepicker.js +28 -34
  100. data/{vendor → app}/assets/javascripts/jquery.ui.dialog.js +84 -28
  101. data/{vendor → app}/assets/javascripts/jquery.ui.draggable.js +96 -84
  102. data/{vendor → app}/assets/javascripts/jquery.ui.droppable.js +33 -15
  103. data/{vendor → app}/assets/javascripts/jquery.ui.effect-blind.js +2 -2
  104. data/{vendor → app}/assets/javascripts/jquery.ui.effect-bounce.js +2 -2
  105. data/{vendor → app}/assets/javascripts/jquery.ui.effect-clip.js +2 -2
  106. data/{vendor → app}/assets/javascripts/jquery.ui.effect-drop.js +2 -2
  107. data/{vendor → app}/assets/javascripts/jquery.ui.effect-explode.js +2 -2
  108. data/{vendor → app}/assets/javascripts/jquery.ui.effect-fade.js +2 -2
  109. data/{vendor → app}/assets/javascripts/jquery.ui.effect-fold.js +2 -2
  110. data/{vendor → app}/assets/javascripts/jquery.ui.effect-highlight.js +2 -2
  111. data/{vendor → app}/assets/javascripts/jquery.ui.effect-pulsate.js +2 -2
  112. data/{vendor → app}/assets/javascripts/jquery.ui.effect-scale.js +2 -2
  113. data/{vendor → app}/assets/javascripts/jquery.ui.effect-shake.js +2 -2
  114. data/{vendor → app}/assets/javascripts/jquery.ui.effect-slide.js +2 -2
  115. data/{vendor → app}/assets/javascripts/jquery.ui.effect-transfer.js +2 -2
  116. data/{vendor → app}/assets/javascripts/jquery.ui.effect.all.js +0 -0
  117. data/{vendor → app}/assets/javascripts/jquery.ui.effect.js +94 -73
  118. data/{vendor → app}/assets/javascripts/jquery.ui.menu.js +15 -9
  119. data/{vendor → app}/assets/javascripts/jquery.ui.mouse.js +3 -3
  120. data/{vendor → app}/assets/javascripts/jquery.ui.position.js +16 -12
  121. data/{vendor → app}/assets/javascripts/jquery.ui.progressbar.js +3 -3
  122. data/{vendor → app}/assets/javascripts/jquery.ui.resizable.js +20 -10
  123. data/{vendor → app}/assets/javascripts/jquery.ui.selectable.js +3 -3
  124. data/{vendor → app}/assets/javascripts/jquery.ui.slider.js +97 -70
  125. data/{vendor → app}/assets/javascripts/jquery.ui.sortable.js +81 -42
  126. data/{vendor → app}/assets/javascripts/jquery.ui.spinner.js +10 -5
  127. data/{vendor → app}/assets/javascripts/jquery.ui.tabs.js +8 -5
  128. data/{vendor → app}/assets/javascripts/jquery.ui.tooltip.js +3 -3
  129. data/{vendor → app}/assets/javascripts/jquery.ui.widget.js +5 -5
  130. data/{vendor → app}/assets/stylesheets/jquery.ui.accordion.css.erb +3 -3
  131. data/{vendor → app}/assets/stylesheets/jquery.ui.all.css.erb +3 -3
  132. data/{vendor → app}/assets/stylesheets/jquery.ui.autocomplete.css.erb +3 -3
  133. data/{vendor → app}/assets/stylesheets/jquery.ui.base.css.erb +3 -3
  134. data/{vendor → app}/assets/stylesheets/jquery.ui.button.css.erb +3 -3
  135. data/{vendor → app}/assets/stylesheets/jquery.ui.core.css.erb +4 -3
  136. data/{vendor → app}/assets/stylesheets/jquery.ui.datepicker.css.erb +3 -6
  137. data/{vendor → app}/assets/stylesheets/jquery.ui.dialog.css.erb +5 -4
  138. data/{vendor → app}/assets/stylesheets/jquery.ui.menu.css.erb +5 -3
  139. data/{vendor → app}/assets/stylesheets/jquery.ui.progressbar.css.erb +9 -4
  140. data/{vendor → app}/assets/stylesheets/jquery.ui.resizable.css.erb +2 -4
  141. data/{vendor → app}/assets/stylesheets/jquery.ui.selectable.css.erb +2 -4
  142. data/{vendor → app}/assets/stylesheets/jquery.ui.slider.css.erb +3 -3
  143. data/{vendor → app}/assets/stylesheets/jquery.ui.spinner.css.erb +5 -5
  144. data/{vendor → app}/assets/stylesheets/jquery.ui.tabs.css.erb +9 -10
  145. data/{vendor → app}/assets/stylesheets/jquery.ui.theme.css.erb +26 -5
  146. data/{vendor → app}/assets/stylesheets/jquery.ui.tooltip.css.erb +4 -2
  147. data/lib/jquery/ui/rails/version.rb +2 -1
  148. metadata +148 -161
  149. data/vendor/assets/javascripts/jquery.ui.datepicker-fr-CH.js +0 -23
@@ -1,10 +1,10 @@
1
1
  //= require jquery.ui.core
2
2
 
3
3
  /*!
4
- * jQuery UI Datepicker 1.10.0
4
+ * jQuery UI Datepicker 1.10.4
5
5
  * http://jqueryui.com
6
6
  *
7
- * Copyright 2013 jQuery Foundation and other contributors
7
+ * Copyright 2014 jQuery Foundation and other contributors
8
8
  * Released under the MIT license.
9
9
  * http://jquery.org/license
10
10
  *
@@ -15,10 +15,9 @@
15
15
  */
16
16
  (function( $, undefined ) {
17
17
 
18
- $.extend($.ui, { datepicker: { version: "1.10.0" } });
18
+ $.extend($.ui, { datepicker: { version: "1.10.4" } });
19
19
 
20
20
  var PROP_NAME = "datepicker",
21
- dpuuid = new Date().getTime(),
22
21
  instActive;
23
22
 
24
23
  /* Date picker manager.
@@ -755,9 +754,10 @@ $.extend(Datepicker.prototype, {
755
754
  inst.dpDiv[showAnim || "show"](showAnim ? duration : null);
756
755
  }
757
756
 
758
- if (inst.input.is(":visible") && !inst.input.is(":disabled")) {
757
+ if ( $.datepicker._shouldFocusInput( inst ) ) {
759
758
  inst.input.focus();
760
759
  }
760
+
761
761
  $.datepicker._curInst = inst;
762
762
  }
763
763
  },
@@ -784,10 +784,7 @@ $.extend(Datepicker.prototype, {
784
784
  inst.dpDiv[(this._get(inst, "isRTL") ? "add" : "remove") +
785
785
  "Class"]("ui-datepicker-rtl");
786
786
 
787
- // #6694 - don't focus the input if it's already focused
788
- // this breaks the change event in IE
789
- if (inst === $.datepicker._curInst && $.datepicker._datepickerShowing && inst.input &&
790
- inst.input.is(":visible") && !inst.input.is(":disabled") && inst.input[0] !== document.activeElement) {
787
+ if (inst === $.datepicker._curInst && $.datepicker._datepickerShowing && $.datepicker._shouldFocusInput( inst ) ) {
791
788
  inst.input.focus();
792
789
  }
793
790
 
@@ -804,16 +801,11 @@ $.extend(Datepicker.prototype, {
804
801
  }
805
802
  },
806
803
 
807
- /* Retrieve the size of left and top borders for an element.
808
- * @param elem (jQuery object) the element of interest
809
- * @return (number[2]) the left and top borders
810
- */
811
- _getBorders: function(elem) {
812
- var convert = function(value) {
813
- return {thin: 1, medium: 2, thick: 3}[value] || value;
814
- };
815
- return [parseFloat(convert(elem.css("border-left-width"))),
816
- parseFloat(convert(elem.css("border-top-width")))];
804
+ // #6694 - don't focus the input if it's already focused
805
+ // this breaks the change event in IE
806
+ // Support: IE and jQuery <1.9
807
+ _shouldFocusInput: function( inst ) {
808
+ return inst.input && inst.input.is( ":visible" ) && !inst.input.is( ":disabled" ) && !inst.input.is( ":focus" );
817
809
  },
818
810
 
819
811
  /* Check positioning to remain on screen. */
@@ -1560,27 +1552,27 @@ $.extend(Datepicker.prototype, {
1560
1552
  inst.dpDiv.find("[data-handler]").map(function () {
1561
1553
  var handler = {
1562
1554
  prev: function () {
1563
- window["DP_jQuery_" + dpuuid].datepicker._adjustDate(id, -stepMonths, "M");
1555
+ $.datepicker._adjustDate(id, -stepMonths, "M");
1564
1556
  },
1565
1557
  next: function () {
1566
- window["DP_jQuery_" + dpuuid].datepicker._adjustDate(id, +stepMonths, "M");
1558
+ $.datepicker._adjustDate(id, +stepMonths, "M");
1567
1559
  },
1568
1560
  hide: function () {
1569
- window["DP_jQuery_" + dpuuid].datepicker._hideDatepicker();
1561
+ $.datepicker._hideDatepicker();
1570
1562
  },
1571
1563
  today: function () {
1572
- window["DP_jQuery_" + dpuuid].datepicker._gotoToday(id);
1564
+ $.datepicker._gotoToday(id);
1573
1565
  },
1574
1566
  selectDay: function () {
1575
- window["DP_jQuery_" + dpuuid].datepicker._selectDay(id, +this.getAttribute("data-month"), +this.getAttribute("data-year"), this);
1567
+ $.datepicker._selectDay(id, +this.getAttribute("data-month"), +this.getAttribute("data-year"), this);
1576
1568
  return false;
1577
1569
  },
1578
1570
  selectMonth: function () {
1579
- window["DP_jQuery_" + dpuuid].datepicker._selectMonthYear(id, this, "M");
1571
+ $.datepicker._selectMonthYear(id, this, "M");
1580
1572
  return false;
1581
1573
  },
1582
1574
  selectYear: function () {
1583
- window["DP_jQuery_" + dpuuid].datepicker._selectMonthYear(id, this, "Y");
1575
+ $.datepicker._selectMonthYear(id, this, "Y");
1584
1576
  return false;
1585
1577
  }
1586
1578
  };
@@ -1743,7 +1735,7 @@ $.extend(Datepicker.prototype, {
1743
1735
  (otherMonth && !showOtherMonths ? "" : " " + daySettings[1] + // highlight custom dates
1744
1736
  (printDate.getTime() === currentDate.getTime() ? " " + this._currentClass : "") + // highlight selected day
1745
1737
  (printDate.getTime() === today.getTime() ? " ui-datepicker-today" : "")) + "'" + // highlight today (if different)
1746
- ((!otherMonth || showOtherMonths) && daySettings[2] ? " title='" + daySettings[2] + "'" : "") + // cell title
1738
+ ((!otherMonth || showOtherMonths) && daySettings[2] ? " title='" + daySettings[2].replace(/'/g, "&#39;") + "'" : "") + // cell title
1747
1739
  (unselectable ? "" : " data-handler='selectDay' data-event='click' data-month='" + printDate.getMonth() + "' data-year='" + printDate.getFullYear() + "'") + ">" + // actions
1748
1740
  (otherMonth && !showOtherMonths ? "&#xa0;" : // display for other months
1749
1741
  (unselectable ? "<span class='ui-state-default'>" + printDate.getDate() + "</span>" : "<a class='ui-state-default" +
@@ -1920,8 +1912,14 @@ $.extend(Datepicker.prototype, {
1920
1912
  if (years){
1921
1913
  yearSplit = years.split(":");
1922
1914
  currentYear = new Date().getFullYear();
1923
- minYear = parseInt(yearSplit[0], 10) + currentYear;
1924
- maxYear = parseInt(yearSplit[1], 10) + currentYear;
1915
+ minYear = parseInt(yearSplit[0], 10);
1916
+ maxYear = parseInt(yearSplit[1], 10);
1917
+ if ( yearSplit[0].match(/[+\-].*/) ) {
1918
+ minYear += currentYear;
1919
+ }
1920
+ if ( yearSplit[1].match(/[+\-].*/) ) {
1921
+ maxYear += currentYear;
1922
+ }
1925
1923
  }
1926
1924
 
1927
1925
  return ((!minDate || date.getTime() >= minDate.getTime()) &&
@@ -2037,10 +2035,6 @@ $.fn.datepicker = function(options){
2037
2035
  $.datepicker = new Datepicker(); // singleton instance
2038
2036
  $.datepicker.initialized = false;
2039
2037
  $.datepicker.uuid = new Date().getTime();
2040
- $.datepicker.version = "1.10.0";
2041
-
2042
- // Workaround for #4055
2043
- // Add another global to avoid noConflict issues with inline event handlers
2044
- window["DP_jQuery_" + dpuuid] = $;
2038
+ $.datepicker.version = "1.10.4";
2045
2039
 
2046
2040
  })(jQuery);
@@ -6,10 +6,10 @@
6
6
  //= require jquery.ui.resizable
7
7
 
8
8
  /*!
9
- * jQuery UI Dialog 1.10.0
9
+ * jQuery UI Dialog 1.10.4
10
10
  * http://jqueryui.com
11
11
  *
12
- * Copyright 2013 jQuery Foundation and other contributors
12
+ * Copyright 2014 jQuery Foundation and other contributors
13
13
  * Released under the MIT license.
14
14
  * http://jquery.org/license
15
15
  *
@@ -43,7 +43,7 @@ var sizeRelatedOptions = {
43
43
  };
44
44
 
45
45
  $.widget( "ui.dialog", {
46
- version: "1.10.0",
46
+ version: "1.10.4",
47
47
  options: {
48
48
  appendTo: "body",
49
49
  autoOpen: true,
@@ -176,7 +176,8 @@ $.widget( "ui.dialog", {
176
176
  enable: $.noop,
177
177
 
178
178
  close: function( event ) {
179
- var that = this;
179
+ var activeElement,
180
+ that = this;
180
181
 
181
182
  if ( !this._isOpen || this._trigger( "beforeClose", event ) === false ) {
182
183
  return;
@@ -186,10 +187,22 @@ $.widget( "ui.dialog", {
186
187
  this._destroyOverlay();
187
188
 
188
189
  if ( !this.opener.filter(":focusable").focus().length ) {
189
- // Hiding a focused element doesn't trigger blur in WebKit
190
- // so in case we have nothing to focus on, explicitly blur the active element
191
- // https://bugs.webkit.org/show_bug.cgi?id=47182
192
- $( this.document[0].activeElement ).blur();
190
+
191
+ // support: IE9
192
+ // IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe>
193
+ try {
194
+ activeElement = this.document[ 0 ].activeElement;
195
+
196
+ // Support: IE9, IE10
197
+ // If the <body> is blurred, IE will switch windows, see #4520
198
+ if ( activeElement && activeElement.nodeName.toLowerCase() !== "body" ) {
199
+
200
+ // Hiding a focused element doesn't trigger blur in WebKit
201
+ // so in case we have nothing to focus on, explicitly blur the active element
202
+ // https://bugs.webkit.org/show_bug.cgi?id=47182
203
+ $( activeElement ).blur();
204
+ }
205
+ } catch ( error ) {}
193
206
  }
194
207
 
195
208
  this._hide( this.uiDialog, this.options.hide, function() {
@@ -214,6 +227,7 @@ $.widget( "ui.dialog", {
214
227
  },
215
228
 
216
229
  open: function() {
230
+ var that = this;
217
231
  if ( this._isOpen ) {
218
232
  if ( this._moveToTop() ) {
219
233
  this._focusTabbable();
@@ -221,19 +235,19 @@ $.widget( "ui.dialog", {
221
235
  return;
222
236
  }
223
237
 
238
+ this._isOpen = true;
224
239
  this.opener = $( this.document[0].activeElement );
225
240
 
226
241
  this._size();
227
242
  this._position();
228
243
  this._createOverlay();
229
244
  this._moveToTop( null, true );
230
- this._show( this.uiDialog, this.options.show );
231
-
232
- this._focusTabbable();
245
+ this._show( this.uiDialog, this.options.show, function() {
246
+ that._focusTabbable();
247
+ that._trigger("focus");
248
+ });
233
249
 
234
- this._isOpen = true;
235
250
  this._trigger("open");
236
- this._trigger("focus");
237
251
  },
238
252
 
239
253
  _focusTabbable: function() {
@@ -348,7 +362,10 @@ $.widget( "ui.dialog", {
348
362
  }
349
363
  });
350
364
 
351
- this.uiDialogTitlebarClose = $("<button></button>")
365
+ // support: IE
366
+ // Use type="button" to prevent enter keypresses in textboxes from closing the
367
+ // dialog in IE (#9312)
368
+ this.uiDialogTitlebarClose = $( "<button type='button'></button>" )
352
369
  .button({
353
370
  label: this.options.closeText,
354
371
  icons: {
@@ -402,7 +419,7 @@ $.widget( "ui.dialog", {
402
419
  this.uiDialogButtonPane.remove();
403
420
  this.uiButtonSet.empty();
404
421
 
405
- if ( $.isEmptyObject( buttons ) ) {
422
+ if ( $.isEmptyObject( buttons ) || ($.isArray( buttons ) && !buttons.length) ) {
406
423
  this.uiDialog.removeClass("ui-dialog-buttons");
407
424
  return;
408
425
  }
@@ -450,6 +467,7 @@ $.widget( "ui.dialog", {
450
467
  containment: "document",
451
468
  start: function( event, ui ) {
452
469
  $( this ).addClass("ui-dialog-dragging");
470
+ that._blockFrames();
453
471
  that._trigger( "dragStart", event, filteredUi( ui ) );
454
472
  },
455
473
  drag: function( event, ui ) {
@@ -461,6 +479,7 @@ $.widget( "ui.dialog", {
461
479
  ui.position.top - that.document.scrollTop()
462
480
  ];
463
481
  $( this ).removeClass("ui-dialog-dragging");
482
+ that._unblockFrames();
464
483
  that._trigger( "dragStop", event, filteredUi( ui ) );
465
484
  }
466
485
  });
@@ -497,6 +516,7 @@ $.widget( "ui.dialog", {
497
516
  handles: resizeHandles,
498
517
  start: function( event, ui ) {
499
518
  $( this ).addClass("ui-dialog-resizing");
519
+ that._blockFrames();
500
520
  that._trigger( "resizeStart", event, filteredUi( ui ) );
501
521
  },
502
522
  resize: function( event, ui ) {
@@ -506,6 +526,7 @@ $.widget( "ui.dialog", {
506
526
  options.height = $( this ).height();
507
527
  options.width = $( this ).width();
508
528
  $( this ).removeClass("ui-dialog-resizing");
529
+ that._unblockFrames();
509
530
  that._trigger( "resizeStop", event, filteredUi( ui ) );
510
531
  }
511
532
  })
@@ -558,7 +579,6 @@ $.widget( "ui.dialog", {
558
579
  },
559
580
 
560
581
  _setOption: function( key, value ) {
561
- /*jshint maxcomplexity:15*/
562
582
  var isDraggable, isResizable,
563
583
  uiDialog = this.uiDialog;
564
584
 
@@ -672,11 +692,45 @@ $.widget( "ui.dialog", {
672
692
  }
673
693
  },
674
694
 
695
+ _blockFrames: function() {
696
+ this.iframeBlocks = this.document.find( "iframe" ).map(function() {
697
+ var iframe = $( this );
698
+
699
+ return $( "<div>" )
700
+ .css({
701
+ position: "absolute",
702
+ width: iframe.outerWidth(),
703
+ height: iframe.outerHeight()
704
+ })
705
+ .appendTo( iframe.parent() )
706
+ .offset( iframe.offset() )[0];
707
+ });
708
+ },
709
+
710
+ _unblockFrames: function() {
711
+ if ( this.iframeBlocks ) {
712
+ this.iframeBlocks.remove();
713
+ delete this.iframeBlocks;
714
+ }
715
+ },
716
+
717
+ _allowInteraction: function( event ) {
718
+ if ( $( event.target ).closest(".ui-dialog").length ) {
719
+ return true;
720
+ }
721
+
722
+ // TODO: Remove hack when datepicker implements
723
+ // the .ui-front logic (#8989)
724
+ return !!$( event.target ).closest(".ui-datepicker").length;
725
+ },
726
+
675
727
  _createOverlay: function() {
676
728
  if ( !this.options.modal ) {
677
729
  return;
678
730
  }
679
731
 
732
+ var that = this,
733
+ widgetFullName = this.widgetFullName;
680
734
  if ( !$.ui.dialog.overlayInstances ) {
681
735
  // Prevent use of anchors and inputs.
682
736
  // We use a delay in case the overlay is created from an
@@ -684,13 +738,11 @@ $.widget( "ui.dialog", {
684
738
  this._delay(function() {
685
739
  // Handle .dialog().dialog("close") (#4065)
686
740
  if ( $.ui.dialog.overlayInstances ) {
687
- this._on( this.document, {
688
- focusin: function( event ) {
689
- if ( !$( event.target ).closest(".ui-dialog").length ) {
690
- event.preventDefault();
691
- $(".ui-dialog:visible:last .ui-dialog-content")
692
- .data("ui-dialog")._focusTabbable();
693
- }
741
+ this.document.bind( "focusin.dialog", function( event ) {
742
+ if ( !that._allowInteraction( event ) ) {
743
+ event.preventDefault();
744
+ $(".ui-dialog:visible:last .ui-dialog-content")
745
+ .data( widgetFullName )._focusTabbable();
694
746
  }
695
747
  });
696
748
  }
@@ -699,7 +751,7 @@ $.widget( "ui.dialog", {
699
751
 
700
752
  this.overlay = $("<div>")
701
753
  .addClass("ui-widget-overlay ui-front")
702
- .appendTo( this.document[0].body );
754
+ .appendTo( this._appendTo() );
703
755
  this._on( this.overlay, {
704
756
  mousedown: "_keepFocus"
705
757
  });
@@ -711,11 +763,15 @@ $.widget( "ui.dialog", {
711
763
  return;
712
764
  }
713
765
 
714
- $.ui.dialog.overlayInstances--;
715
- if ( !$.ui.dialog.overlayInstances ) {
716
- this._off( this.document, "focusin" );
766
+ if ( this.overlay ) {
767
+ $.ui.dialog.overlayInstances--;
768
+
769
+ if ( !$.ui.dialog.overlayInstances ) {
770
+ this.document.unbind( "focusin.dialog" );
771
+ }
772
+ this.overlay.remove();
773
+ this.overlay = null;
717
774
  }
718
- this.overlay.remove();
719
775
  }
720
776
  });
721
777