jQuery UI 1.8.6 Upgrade Guide


link Overview

This guide will assist in upgrading from jQuery UI 1.8.5 to jQuery UI 1.8.6. All changes are listed below, organized by plugin, along with how to upgrade your code to work with jQuery UI 1.8.6.

link Widget

link Added ability to define new methods for gathering options on initialization

(#6158) Sometimes you want to allow users to specify options through a method other than passing an object during initialization. For example, you may want to allow users to specify options through data attributes, but still have any options passed during initialization take precedence. This is now possibly by defining a _getCreateOptions() method.

Here's an example from jQuery Mobile which will check for data attributes based on which options are defined in the widget's prototype:

1
2
3
4
5
6
7
8
9
10
11
12
13
_getCreateOptions: function() {
var elem = this.element,
options = {};
$.each( this.options, function( option ) {
var value = elem.data( option.replace( /[A-Z]/g, function( c ) {
return "-" + c.toLowerCase();
} ) );
if ( value !== undefined ) {
options[ option ] = value;
}
});
return options;
}

link Widgets no longer throw errors for invalid method calls

(#5972) In 1.8.5, widgets started throwing errors when calling a method that doesn't exist, or calling a method before a widget has been initialized. We have reverted back to the previous behavior of simply ignoring these calls because this was a breaking change that should not have been introduced in a minor release. However, we will go back to throwing errors in the next major release.

link Autocomplete

link Allow default behavior on enter when menu is open but inactive

(#6038) (#6055) Previously when pressing enter while the menu was open, we would prevent the default action only if a menu item was active (highlighted). We now prevent the default action solely based on the visibility of the menu, so even if no menu item is active, we still prevent the default action. This prevents forms from submitting when the user is just trying to enter a value in the text field. Additionally, there was a bug in Opera where the form would be submitted even when we prevented the default action; this has been fixed.

link Split menu resizing logic into its own method

The code for resizing the menu after each search has been moved out of the _suggest() method and into a new _resizeMenu() method. This provides a more logical method to override if you are trying to implement custom menu sizing.

link Dialog

link Don't change DOM position on open

(#6137) (#4589) (#4534) Dialogs no longer get moved around in the DOM when they are opened. The only time the dialog is moved now is during initialization when it is appended to the body. This fixes a slew of problems, such as form elements being reset, iframes reloading, etc.

link Progressbar

link Added complete event

(#3500) Progressbar now has a complete event that is triggered when the value option reaches the same value as the max option.

1
2
3
4
5
6
7
8
9
$( "#progressbar" ).progressbar({
complete: function() {
alert( "The action is complete!" );
}
});
$( ":ui-progressbar" ).live( "progressbarcomplete", function() {
alert( "Some action has completed." );
});

link Effects

link Allow borderColor to be animated

(#6164) You can now pass the borderColor shorthand property to .animate() in order to animate all borders with a single property.

1
2
3
$( "#elem" ).animate({
borderColor: "red"
});