activeadmin 3.2.1 → 3.2.2

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.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +13 -0
  3. data/lib/active_admin/version.rb +1 -1
  4. data/lib/active_admin/views/components/active_admin_form.rb +1 -1
  5. data/vendor/assets/javascripts/jquery-ui/data.js +12 -8
  6. data/vendor/assets/javascripts/jquery-ui/disable-selection.js +10 -7
  7. data/vendor/assets/javascripts/jquery-ui/focusable.js +12 -9
  8. data/vendor/assets/javascripts/jquery-ui/form-reset-mixin.js +60 -57
  9. data/vendor/assets/javascripts/jquery-ui/form.js +15 -12
  10. data/vendor/assets/javascripts/jquery-ui/ie.js +5 -2
  11. data/vendor/assets/javascripts/jquery-ui/keycode.js +11 -7
  12. data/vendor/assets/javascripts/jquery-ui/labels.js +46 -40
  13. data/vendor/assets/javascripts/jquery-ui/plugin.js +5 -2
  14. data/vendor/assets/javascripts/jquery-ui/position.js +30 -17
  15. data/vendor/assets/javascripts/jquery-ui/safe-active-element.js +6 -2
  16. data/vendor/assets/javascripts/jquery-ui/safe-blur.js +6 -2
  17. data/vendor/assets/javascripts/jquery-ui/scroll-parent.js +10 -7
  18. data/vendor/assets/javascripts/jquery-ui/tabbable.js +11 -8
  19. data/vendor/assets/javascripts/jquery-ui/unique-id.js +10 -7
  20. data/vendor/assets/javascripts/jquery-ui/version.js +6 -3
  21. data/vendor/assets/javascripts/jquery-ui/widget.js +53 -30
  22. data/vendor/assets/javascripts/jquery-ui/widgets/button.js +87 -24
  23. data/vendor/assets/javascripts/jquery-ui/widgets/checkboxradio.js +276 -273
  24. data/vendor/assets/javascripts/jquery-ui/widgets/controlgroup.js +15 -11
  25. data/vendor/assets/javascripts/jquery-ui/widgets/datepicker.js +182 -62
  26. data/vendor/assets/javascripts/jquery-ui/widgets/dialog.js +53 -36
  27. data/vendor/assets/javascripts/jquery-ui/widgets/draggable.js +28 -19
  28. data/vendor/assets/javascripts/jquery-ui/widgets/mouse.js +22 -11
  29. data/vendor/assets/javascripts/jquery-ui/widgets/resizable.js +47 -26
  30. data/vendor/assets/javascripts/jquery-ui/widgets/sortable.js +186 -125
  31. data/vendor/assets/javascripts/jquery-ui/widgets/tabs.js +20 -20
  32. metadata +3 -4
  33. data/vendor/assets/javascripts/jquery-ui/escape-selector.js +0 -23
@@ -1,23 +1,25 @@
1
1
  //= require jquery-ui/version
2
2
 
3
3
  /*!
4
- * jQuery UI Position 1.12.1
5
- * http://jqueryui.com
4
+ * jQuery UI Position 1.13.3
5
+ * https://jqueryui.com
6
6
  *
7
- * Copyright jQuery Foundation and other contributors
7
+ * Copyright OpenJS Foundation and other contributors
8
8
  * Released under the MIT license.
9
- * http://jquery.org/license
9
+ * https://jquery.org/license
10
10
  *
11
- * http://api.jqueryui.com/position/
11
+ * https://api.jqueryui.com/position/
12
12
  */
13
13
 
14
14
  //>>label: Position
15
15
  //>>group: Core
16
16
  //>>description: Positions elements relative to other elements.
17
- //>>docs: http://api.jqueryui.com/position/
18
- //>>demos: http://jqueryui.com/position/
17
+ //>>docs: https://api.jqueryui.com/position/
18
+ //>>demos: https://jqueryui.com/position/
19
19
 
20
20
  ( function( factory ) {
21
+ "use strict";
22
+
21
23
  if ( typeof define === "function" && define.amd ) {
22
24
 
23
25
  // AMD. Register as an anonymous module.
@@ -27,7 +29,9 @@
27
29
  // Browser globals
28
30
  factory( jQuery );
29
31
  }
30
- }( function( $ ) {
32
+ } )( function( $ ) {
33
+ "use strict";
34
+
31
35
  ( function() {
32
36
  var cachedScrollbarWidth,
33
37
  max = Math.max,
@@ -50,6 +54,10 @@ function parseCss( element, property ) {
50
54
  return parseInt( $.css( element, property ), 10 ) || 0;
51
55
  }
52
56
 
57
+ function isWindow( obj ) {
58
+ return obj != null && obj === obj.window;
59
+ }
60
+
53
61
  function getDimensions( elem ) {
54
62
  var raw = elem[ 0 ];
55
63
  if ( raw.nodeType === 9 ) {
@@ -59,7 +67,7 @@ function getDimensions( elem ) {
59
67
  offset: { top: 0, left: 0 }
60
68
  };
61
69
  }
62
- if ( $.isWindow( raw ) ) {
70
+ if ( isWindow( raw ) ) {
63
71
  return {
64
72
  width: elem.width(),
65
73
  height: elem.height(),
@@ -86,9 +94,9 @@ $.position = {
86
94
  return cachedScrollbarWidth;
87
95
  }
88
96
  var w1, w2,
89
- div = $( "<div " +
90
- "style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'>" +
91
- "<div style='height:100px;width:auto;'></div></div>" ),
97
+ div = $( "<div style=" +
98
+ "'display:block;position:absolute;width:200px;height:200px;overflow:hidden;'>" +
99
+ "<div style='height:300px;width:auto;'></div></div>" ),
92
100
  innerDiv = div.children()[ 0 ];
93
101
 
94
102
  $( "body" ).append( div );
@@ -121,12 +129,12 @@ $.position = {
121
129
  },
122
130
  getWithinInfo: function( element ) {
123
131
  var withinElement = $( element || window ),
124
- isWindow = $.isWindow( withinElement[ 0 ] ),
132
+ isElemWindow = isWindow( withinElement[ 0 ] ),
125
133
  isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9,
126
- hasOffset = !isWindow && !isDocument;
134
+ hasOffset = !isElemWindow && !isDocument;
127
135
  return {
128
136
  element: withinElement,
129
- isWindow: isWindow,
137
+ isWindow: isElemWindow,
130
138
  isDocument: isDocument,
131
139
  offset: hasOffset ? $( element ).offset() : { left: 0, top: 0 },
132
140
  scrollLeft: withinElement.scrollLeft(),
@@ -146,7 +154,12 @@ $.fn.position = function( options ) {
146
154
  options = $.extend( {}, options );
147
155
 
148
156
  var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions,
149
- target = $( options.of ),
157
+
158
+ // Make sure string options are treated as CSS selectors
159
+ target = typeof options.of === "string" ?
160
+ $( document ).find( options.of ) :
161
+ $( options.of ),
162
+
150
163
  within = $.position.getWithinInfo( options.within ),
151
164
  scrollInfo = $.position.getScrollInfo( within ),
152
165
  collision = ( options.collision || "flip" ).split( " " ),
@@ -497,4 +510,4 @@ $.ui.position = {
497
510
 
498
511
  return $.ui.position;
499
512
 
500
- } ) );
513
+ } );
@@ -1,6 +1,8 @@
1
1
  //= require jquery-ui/version
2
2
 
3
3
  ( function( factory ) {
4
+ "use strict";
5
+
4
6
  if ( typeof define === "function" && define.amd ) {
5
7
 
6
8
  // AMD. Register as an anonymous module.
@@ -10,7 +12,9 @@
10
12
  // Browser globals
11
13
  factory( jQuery );
12
14
  }
13
- } ( function( $ ) {
15
+ } )( function( $ ) {
16
+ "use strict";
17
+
14
18
  return $.ui.safeActiveElement = function( document ) {
15
19
  var activeElement;
16
20
 
@@ -39,4 +43,4 @@ return $.ui.safeActiveElement = function( document ) {
39
43
  return activeElement;
40
44
  };
41
45
 
42
- } ) );
46
+ } );
@@ -1,6 +1,8 @@
1
1
  //= require jquery-ui/version
2
2
 
3
3
  ( function( factory ) {
4
+ "use strict";
5
+
4
6
  if ( typeof define === "function" && define.amd ) {
5
7
 
6
8
  // AMD. Register as an anonymous module.
@@ -10,7 +12,9 @@
10
12
  // Browser globals
11
13
  factory( jQuery );
12
14
  }
13
- } ( function( $ ) {
15
+ } )( function( $ ) {
16
+ "use strict";
17
+
14
18
  return $.ui.safeBlur = function( element ) {
15
19
 
16
20
  // Support: IE9 - 10 only
@@ -20,4 +24,4 @@ return $.ui.safeBlur = function( element ) {
20
24
  }
21
25
  };
22
26
 
23
- } ) );
27
+ } );
@@ -1,20 +1,22 @@
1
1
  //= require jquery-ui/version
2
2
 
3
3
  /*!
4
- * jQuery UI Scroll Parent 1.12.1
5
- * http://jqueryui.com
4
+ * jQuery UI Scroll Parent 1.13.3
5
+ * https://jqueryui.com
6
6
  *
7
- * Copyright jQuery Foundation and other contributors
7
+ * Copyright OpenJS Foundation and other contributors
8
8
  * Released under the MIT license.
9
- * http://jquery.org/license
9
+ * https://jquery.org/license
10
10
  */
11
11
 
12
12
  //>>label: scrollParent
13
13
  //>>group: Core
14
14
  //>>description: Get the closest ancestor element that is scrollable.
15
- //>>docs: http://api.jqueryui.com/scrollParent/
15
+ //>>docs: https://api.jqueryui.com/scrollParent/
16
16
 
17
17
  ( function( factory ) {
18
+ "use strict";
19
+
18
20
  if ( typeof define === "function" && define.amd ) {
19
21
 
20
22
  // AMD. Register as an anonymous module.
@@ -24,7 +26,8 @@
24
26
  // Browser globals
25
27
  factory( jQuery );
26
28
  }
27
- } ( function( $ ) {
29
+ } )( function( $ ) {
30
+ "use strict";
28
31
 
29
32
  return $.fn.scrollParent = function( includeHidden ) {
30
33
  var position = this.css( "position" ),
@@ -44,4 +47,4 @@ return $.fn.scrollParent = function( includeHidden ) {
44
47
  scrollParent;
45
48
  };
46
49
 
47
- } ) );
50
+ } );
@@ -2,20 +2,22 @@
2
2
  //= require jquery-ui/focusable
3
3
 
4
4
  /*!
5
- * jQuery UI Tabbable 1.12.1
6
- * http://jqueryui.com
5
+ * jQuery UI Tabbable 1.13.3
6
+ * https://jqueryui.com
7
7
  *
8
- * Copyright jQuery Foundation and other contributors
8
+ * Copyright OpenJS Foundation and other contributors
9
9
  * Released under the MIT license.
10
- * http://jquery.org/license
10
+ * https://jquery.org/license
11
11
  */
12
12
 
13
13
  //>>label: :tabbable Selector
14
14
  //>>group: Core
15
15
  //>>description: Selects elements which can be tabbed to.
16
- //>>docs: http://api.jqueryui.com/tabbable-selector/
16
+ //>>docs: https://api.jqueryui.com/tabbable-selector/
17
17
 
18
18
  ( function( factory ) {
19
+ "use strict";
20
+
19
21
  if ( typeof define === "function" && define.amd ) {
20
22
 
21
23
  // AMD. Register as an anonymous module.
@@ -25,9 +27,10 @@
25
27
  // Browser globals
26
28
  factory( jQuery );
27
29
  }
28
- } ( function( $ ) {
30
+ } )( function( $ ) {
31
+ "use strict";
29
32
 
30
- return $.extend( $.expr[ ":" ], {
33
+ return $.extend( $.expr.pseudos, {
31
34
  tabbable: function( element ) {
32
35
  var tabIndex = $.attr( element, "tabindex" ),
33
36
  hasTabindex = tabIndex != null;
@@ -35,4 +38,4 @@ return $.extend( $.expr[ ":" ], {
35
38
  }
36
39
  } );
37
40
 
38
- } ) );
41
+ } );
@@ -1,20 +1,22 @@
1
1
  //= require jquery-ui/version
2
2
 
3
3
  /*!
4
- * jQuery UI Unique ID 1.12.1
5
- * http://jqueryui.com
4
+ * jQuery UI Unique ID 1.13.3
5
+ * https://jqueryui.com
6
6
  *
7
- * Copyright jQuery Foundation and other contributors
7
+ * Copyright OpenJS Foundation and other contributors
8
8
  * Released under the MIT license.
9
- * http://jquery.org/license
9
+ * https://jquery.org/license
10
10
  */
11
11
 
12
12
  //>>label: uniqueId
13
13
  //>>group: Core
14
14
  //>>description: Functions to generate and remove uniqueId's
15
- //>>docs: http://api.jqueryui.com/uniqueId/
15
+ //>>docs: https://api.jqueryui.com/uniqueId/
16
16
 
17
17
  ( function( factory ) {
18
+ "use strict";
19
+
18
20
  if ( typeof define === "function" && define.amd ) {
19
21
 
20
22
  // AMD. Register as an anonymous module.
@@ -24,7 +26,8 @@
24
26
  // Browser globals
25
27
  factory( jQuery );
26
28
  }
27
- } ( function( $ ) {
29
+ } )( function( $ ) {
30
+ "use strict";
28
31
 
29
32
  return $.fn.extend( {
30
33
  uniqueId: ( function() {
@@ -48,4 +51,4 @@ return $.fn.extend( {
48
51
  }
49
52
  } );
50
53
 
51
- } ) );
54
+ } );
@@ -1,4 +1,6 @@
1
1
  ( function( factory ) {
2
+ "use strict";
3
+
2
4
  if ( typeof define === "function" && define.amd ) {
3
5
 
4
6
  // AMD. Register as an anonymous module.
@@ -8,10 +10,11 @@
8
10
  // Browser globals
9
11
  factory( jQuery );
10
12
  }
11
- } ( function( $ ) {
13
+ } )( function( $ ) {
14
+ "use strict";
12
15
 
13
16
  $.ui = $.ui || {};
14
17
 
15
- return $.ui.version = "1.12.1";
18
+ return $.ui.version = "1.13.3";
16
19
 
17
- } ) );
20
+ } );
@@ -1,21 +1,23 @@
1
1
  //= require jquery-ui/version
2
2
 
3
3
  /*!
4
- * jQuery UI Widget 1.12.1
5
- * http://jqueryui.com
4
+ * jQuery UI Widget 1.13.3
5
+ * https://jqueryui.com
6
6
  *
7
- * Copyright jQuery Foundation and other contributors
7
+ * Copyright OpenJS Foundation and other contributors
8
8
  * Released under the MIT license.
9
- * http://jquery.org/license
9
+ * https://jquery.org/license
10
10
  */
11
11
 
12
12
  //>>label: Widget
13
13
  //>>group: Core
14
14
  //>>description: Provides a factory for creating stateful widgets with a common API.
15
- //>>docs: http://api.jqueryui.com/jQuery.widget/
16
- //>>demos: http://jqueryui.com/widget/
15
+ //>>docs: https://api.jqueryui.com/jQuery.widget/
16
+ //>>demos: https://jqueryui.com/widget/
17
17
 
18
18
  ( function( factory ) {
19
+ "use strict";
20
+
19
21
  if ( typeof define === "function" && define.amd ) {
20
22
 
21
23
  // AMD. Register as an anonymous module.
@@ -25,25 +27,23 @@
25
27
  // Browser globals
26
28
  factory( jQuery );
27
29
  }
28
- }( function( $ ) {
30
+ } )( function( $ ) {
31
+ "use strict";
29
32
 
30
33
  var widgetUuid = 0;
34
+ var widgetHasOwnProperty = Array.prototype.hasOwnProperty;
31
35
  var widgetSlice = Array.prototype.slice;
32
36
 
33
37
  $.cleanData = ( function( orig ) {
34
38
  return function( elems ) {
35
39
  var events, elem, i;
36
40
  for ( i = 0; ( elem = elems[ i ] ) != null; i++ ) {
37
- try {
38
-
39
- // Only trigger remove when necessary to save time
40
- events = $._data( elem, "events" );
41
- if ( events && events.remove ) {
42
- $( elem ).triggerHandler( "remove" );
43
- }
44
41
 
45
- // Http://bugs.jquery.com/ticket/8235
46
- } catch ( e ) {}
42
+ // Only trigger remove when necessary to save time
43
+ events = $._data( elem, "events" );
44
+ if ( events && events.remove ) {
45
+ $( elem ).triggerHandler( "remove" );
46
+ }
47
47
  }
48
48
  orig( elems );
49
49
  };
@@ -65,12 +65,12 @@ $.widget = function( name, base, prototype ) {
65
65
  base = $.Widget;
66
66
  }
67
67
 
68
- if ( $.isArray( prototype ) ) {
68
+ if ( Array.isArray( prototype ) ) {
69
69
  prototype = $.extend.apply( null, [ {} ].concat( prototype ) );
70
70
  }
71
71
 
72
72
  // Create selector for plugin
73
- $.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) {
73
+ $.expr.pseudos[ fullName.toLowerCase() ] = function( elem ) {
74
74
  return !!$.data( elem, fullName );
75
75
  };
76
76
 
@@ -79,7 +79,7 @@ $.widget = function( name, base, prototype ) {
79
79
  constructor = $[ namespace ][ name ] = function( options, element ) {
80
80
 
81
81
  // Allow instantiation without "new" keyword
82
- if ( !this._createWidget ) {
82
+ if ( !this || !this._createWidget ) {
83
83
  return new constructor( options, element );
84
84
  }
85
85
 
@@ -110,7 +110,7 @@ $.widget = function( name, base, prototype ) {
110
110
  // inheriting from
111
111
  basePrototype.options = $.widget.extend( {}, basePrototype.options );
112
112
  $.each( prototype, function( prop, value ) {
113
- if ( !$.isFunction( value ) ) {
113
+ if ( typeof value !== "function" ) {
114
114
  proxiedPrototype[ prop ] = value;
115
115
  return;
116
116
  }
@@ -189,7 +189,7 @@ $.widget.extend = function( target ) {
189
189
  for ( ; inputIndex < inputLength; inputIndex++ ) {
190
190
  for ( key in input[ inputIndex ] ) {
191
191
  value = input[ inputIndex ][ key ];
192
- if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {
192
+ if ( widgetHasOwnProperty.call( input[ inputIndex ], key ) && value !== undefined ) {
193
193
 
194
194
  // Clone objects
195
195
  if ( $.isPlainObject( value ) ) {
@@ -238,7 +238,8 @@ $.widget.bridge = function( name, object ) {
238
238
  "attempted to call method '" + options + "'" );
239
239
  }
240
240
 
241
- if ( !$.isFunction( instance[ options ] ) || options.charAt( 0 ) === "_" ) {
241
+ if ( typeof instance[ options ] !== "function" ||
242
+ options.charAt( 0 ) === "_" ) {
242
243
  return $.error( "no such method '" + options + "' for " + name +
243
244
  " widget instance" );
244
245
  }
@@ -499,12 +500,34 @@ $.Widget.prototype = {
499
500
  classes: this.options.classes || {}
500
501
  }, options );
501
502
 
503
+ function bindRemoveEvent() {
504
+ var nodesToBind = [];
505
+
506
+ options.element.each( function( _, element ) {
507
+ var isTracked = $.map( that.classesElementLookup, function( elements ) {
508
+ return elements;
509
+ } )
510
+ .some( function( elements ) {
511
+ return elements.is( element );
512
+ } );
513
+
514
+ if ( !isTracked ) {
515
+ nodesToBind.push( element );
516
+ }
517
+ } );
518
+
519
+ that._on( $( nodesToBind ), {
520
+ remove: "_untrackClassesElement"
521
+ } );
522
+ }
523
+
502
524
  function processClassString( classes, checkOption ) {
503
525
  var current, i;
504
526
  for ( i = 0; i < classes.length; i++ ) {
505
527
  current = that.classesElementLookup[ classes[ i ] ] || $();
506
528
  if ( options.add ) {
507
- current = $( $.unique( current.get().concat( options.element.get() ) ) );
529
+ bindRemoveEvent();
530
+ current = $( $.uniqueSort( current.get().concat( options.element.get() ) ) );
508
531
  } else {
509
532
  current = $( current.not( options.element ).get() );
510
533
  }
@@ -516,10 +539,6 @@ $.Widget.prototype = {
516
539
  }
517
540
  }
518
541
 
519
- this._on( options.element, {
520
- "remove": "_untrackClassesElement"
521
- } );
522
-
523
542
  if ( options.keys ) {
524
543
  processClassString( options.keys.match( /\S+/g ) || [], true );
525
544
  }
@@ -537,6 +556,8 @@ $.Widget.prototype = {
537
556
  that.classesElementLookup[ key ] = $( value.not( event.target ).get() );
538
557
  }
539
558
  } );
559
+
560
+ this._off( $( event.target ) );
540
561
  },
541
562
 
542
563
  _removeClass: function( element, keys, extra ) {
@@ -617,7 +638,7 @@ $.Widget.prototype = {
617
638
  _off: function( element, eventName ) {
618
639
  eventName = ( eventName || "" ).split( " " ).join( this.eventNamespace + " " ) +
619
640
  this.eventNamespace;
620
- element.off( eventName ).off( eventName );
641
+ element.off( eventName );
621
642
 
622
643
  // Clear the stack to avoid memory leaks (#10056)
623
644
  this.bindings = $( this.bindings.not( element ).get() );
@@ -683,7 +704,7 @@ $.Widget.prototype = {
683
704
  }
684
705
 
685
706
  this.element.trigger( event, data );
686
- return !( $.isFunction( callback ) &&
707
+ return !( typeof callback === "function" &&
687
708
  callback.apply( this.element[ 0 ], [ event ].concat( data ) ) === false ||
688
709
  event.isDefaultPrevented() );
689
710
  }
@@ -705,6 +726,8 @@ $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
705
726
  options = options || {};
706
727
  if ( typeof options === "number" ) {
707
728
  options = { duration: options };
729
+ } else if ( options === true ) {
730
+ options = {};
708
731
  }
709
732
 
710
733
  hasOptions = !$.isEmptyObject( options );
@@ -732,4 +755,4 @@ $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
732
755
 
733
756
  return $.widget;
734
757
 
735
- } ) );
758
+ } );
@@ -4,24 +4,26 @@
4
4
  //= require jquery-ui/widget
5
5
 
6
6
  /*!
7
- * jQuery UI Button 1.12.1
8
- * http://jqueryui.com
7
+ * jQuery UI Button 1.13.3
8
+ * https://jqueryui.com
9
9
  *
10
- * Copyright jQuery Foundation and other contributors
10
+ * Copyright OpenJS Foundation and other contributors
11
11
  * Released under the MIT license.
12
- * http://jquery.org/license
12
+ * https://jquery.org/license
13
13
  */
14
14
 
15
15
  //>>label: Button
16
16
  //>>group: Widgets
17
17
  //>>description: Enhances a form with themeable buttons.
18
- //>>docs: http://api.jqueryui.com/button/
19
- //>>demos: http://jqueryui.com/button/
18
+ //>>docs: https://api.jqueryui.com/button/
19
+ //>>demos: https://jqueryui.com/button/
20
20
  //>>css.structure: ../../themes/base/core.css
21
21
  //>>css.structure: ../../themes/base/button.css
22
22
  //>>css.theme: ../../themes/base/theme.css
23
23
 
24
24
  ( function( factory ) {
25
+ "use strict";
26
+
25
27
  if ( typeof define === "function" && define.amd ) {
26
28
 
27
29
  // AMD. Register as an anonymous module.
@@ -41,10 +43,11 @@
41
43
  // Browser globals
42
44
  factory( jQuery );
43
45
  }
44
- }( function( $ ) {
46
+ } )( function( $ ) {
47
+ "use strict";
45
48
 
46
49
  $.widget( "ui.button", {
47
- version: "1.12.1",
50
+ version: "1.13.3",
48
51
  defaultElement: "<button>",
49
52
  options: {
50
53
  classes: {
@@ -268,7 +271,7 @@ $.widget( "ui.button", {
268
271
  this._toggleClass( null, "ui-state-disabled", value );
269
272
  this.element[ 0 ].disabled = value;
270
273
  if ( value ) {
271
- this.element.blur();
274
+ this.element.trigger( "blur" );
272
275
  }
273
276
  }
274
277
  },
@@ -347,22 +350,82 @@ if ( $.uiBackCompat !== false ) {
347
350
  } );
348
351
 
349
352
  $.fn.button = ( function( orig ) {
350
- return function() {
351
- if ( !this.length || ( this.length && this[ 0 ].tagName !== "INPUT" ) ||
352
- ( this.length && this[ 0 ].tagName === "INPUT" && (
353
- this.attr( "type" ) !== "checkbox" && this.attr( "type" ) !== "radio"
354
- ) ) ) {
355
- return orig.apply( this, arguments );
356
- }
357
- if ( !$.ui.checkboxradio ) {
358
- $.error( "Checkboxradio widget missing" );
359
- }
360
- if ( arguments.length === 0 ) {
361
- return this.checkboxradio( {
362
- "icon": false
353
+ return function( options ) {
354
+ var isMethodCall = typeof options === "string";
355
+ var args = Array.prototype.slice.call( arguments, 1 );
356
+ var returnValue = this;
357
+
358
+ if ( isMethodCall ) {
359
+
360
+ // If this is an empty collection, we need to have the instance method
361
+ // return undefined instead of the jQuery instance
362
+ if ( !this.length && options === "instance" ) {
363
+ returnValue = undefined;
364
+ } else {
365
+ this.each( function() {
366
+ var methodValue;
367
+ var type = $( this ).attr( "type" );
368
+ var name = type !== "checkbox" && type !== "radio" ?
369
+ "button" :
370
+ "checkboxradio";
371
+ var instance = $.data( this, "ui-" + name );
372
+
373
+ if ( options === "instance" ) {
374
+ returnValue = instance;
375
+ return false;
376
+ }
377
+
378
+ if ( !instance ) {
379
+ return $.error( "cannot call methods on button" +
380
+ " prior to initialization; " +
381
+ "attempted to call method '" + options + "'" );
382
+ }
383
+
384
+ if ( typeof instance[ options ] !== "function" ||
385
+ options.charAt( 0 ) === "_" ) {
386
+ return $.error( "no such method '" + options + "' for button" +
387
+ " widget instance" );
388
+ }
389
+
390
+ methodValue = instance[ options ].apply( instance, args );
391
+
392
+ if ( methodValue !== instance && methodValue !== undefined ) {
393
+ returnValue = methodValue && methodValue.jquery ?
394
+ returnValue.pushStack( methodValue.get() ) :
395
+ methodValue;
396
+ return false;
397
+ }
398
+ } );
399
+ }
400
+ } else {
401
+
402
+ // Allow multiple hashes to be passed on init
403
+ if ( args.length ) {
404
+ options = $.widget.extend.apply( null, [ options ].concat( args ) );
405
+ }
406
+
407
+ this.each( function() {
408
+ var type = $( this ).attr( "type" );
409
+ var name = type !== "checkbox" && type !== "radio" ? "button" : "checkboxradio";
410
+ var instance = $.data( this, "ui-" + name );
411
+
412
+ if ( instance ) {
413
+ instance.option( options || {} );
414
+ if ( instance._init ) {
415
+ instance._init();
416
+ }
417
+ } else {
418
+ if ( name === "button" ) {
419
+ orig.call( $( this ), options );
420
+ return;
421
+ }
422
+
423
+ $( this ).checkboxradio( $.extend( { icon: false }, options ) );
424
+ }
363
425
  } );
364
426
  }
365
- return this.checkboxradio.apply( this, arguments );
427
+
428
+ return returnValue;
366
429
  };
367
430
  } )( $.fn.button );
368
431
 
@@ -388,4 +451,4 @@ if ( $.uiBackCompat !== false ) {
388
451
 
389
452
  return $.ui.button;
390
453
 
391
- } ) );
454
+ } );