From 6e799c39d33be8eee02224d2f754dc42228a4cbb Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Wed, 11 Sep 2013 22:11:58 +0200 Subject: Widget Bridge: Make the _init method optional. Add tests for both states. Fixes #9543 - Widget bridge: Make _init() optional. --- ui/jquery.ui.widget.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'ui/jquery.ui.widget.js') diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js index 885e2019f..b4aab5f3e 100644 --- a/ui/jquery.ui.widget.js +++ b/ui/jquery.ui.widget.js @@ -203,7 +203,10 @@ $.widget.bridge = function( name, object ) { this.each(function() { var instance = $.data( this, fullName ); if ( instance ) { - instance.option( options || {} )._init(); + instance.option( options || {} ); + if ( instance._init ) { + instance._init(); + } } else { $.data( this, fullName, new object( options, this ) ); } -- cgit v1.2.3 From d13df39e39010bb7cf2cec11b5206e85ea5fca2a Mon Sep 17 00:00:00 2001 From: Scott González Date: Mon, 16 Sep 2013 11:57:35 -0400 Subject: Widget: Only remove hover and focus classes when disabling, not enabling. Fixes #9558 - Widget: .enable() while already enabled kills ui-state-focus and ui-state-hover. --- ui/jquery.ui.widget.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'ui/jquery.ui.widget.js') diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js index b4aab5f3e..a46dcaf99 100644 --- a/ui/jquery.ui.widget.js +++ b/ui/jquery.ui.widget.js @@ -352,8 +352,12 @@ $.Widget.prototype = { if ( key === "disabled" ) { this.widget() .toggleClass( this.widgetFullName + "-disabled", !!value ); - this.hoverable.removeClass( "ui-state-hover" ); - this.focusable.removeClass( "ui-state-focus" ); + + // If the widget is becoming disabled, then nothing is interactive + if ( value ) { + this.hoverable.removeClass( "ui-state-hover" ); + this.focusable.removeClass( "ui-state-focus" ); + } } return this; -- cgit v1.2.3