Permalink
Browse files

Form widgets: Add reset handling via $.extend, not $.widget to avoid …

…additional subclass depth

(cherry picked from commit 871a4f8)
  • Loading branch information...
1 parent 5bacbbc commit ab6dbff3eaadd06a44c9e8a9aa44994b934bbd37 @gabrielschulhof gabrielschulhof committed Feb 26, 2013
Showing with 10 additions and 21 deletions.
  1. +3 −7 js/widgets/forms/checkboxradio.js
  2. +4 −7 js/widgets/forms/select.js
  3. +3 −7 js/widgets/forms/slider.js
@@ -13,7 +13,7 @@ define( [ "jquery", "../../jquery.mobile.core", "../../jquery.mobile.widget", ".
//>>excludeEnd("jqmBuildExclude");
(function( $, undefined ) {
-$.widget( "mobile.checkboxradio", $.mobile.widget, {
+$.widget( "mobile.checkboxradio", $.mobile.widget, $.extend( {
options: {
theme: null,
mini: false,
@@ -136,9 +136,7 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, {
}
});
- if ( this._handleFormReset ) {
- this._handleFormReset();
- }
+ this._handleFormReset();
this.refresh();
},
@@ -201,9 +199,7 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, {
enable: function() {
this.element.prop( "disabled", false ).parent().removeClass( "ui-disabled" );
}
-});
-
-$.widget( "mobile.checkboxradio", $.mobile.checkboxradio, $.mobile.behaviors.formReset );
+}, $.mobile.behaviors.formReset ) );
//auto self-init widgets
$.mobile.document.bind( "pagecreate create", function( e ) {
@@ -9,7 +9,7 @@ define( [ "jquery", "../../jquery.mobile.core", "../../jquery.mobile.widget", ".
//>>excludeEnd("jqmBuildExclude");
(function( $, undefined ) {
-$.widget( "mobile.selectmenu", $.mobile.widget, {
+$.widget( "mobile.selectmenu", $.mobile.widget, $.extend( {
options: {
theme: null,
disabled: false,
@@ -152,9 +152,8 @@ $.widget( "mobile.selectmenu", $.mobile.widget, {
self.refresh();
});
- if ( this._handleFormReset ) {
- this._handleFormReset();
- }
+ this._handleFormReset();
+
this.build();
},
@@ -285,9 +284,7 @@ $.widget( "mobile.selectmenu", $.mobile.widget, {
this._setDisabled( false );
this.button.removeClass( "ui-disabled" );
}
-});
-
-$.widget( "mobile.selectmenu", $.mobile.selectmenu, $.mobile.behaviors.formReset );
+}, $.mobile.behaviors.formReset ) );
//auto self-init widgets
$.mobile.document.bind( "pagecreate create", function( e ) {
@@ -9,7 +9,7 @@ define( [ "jquery", "../../jquery.mobile.core", "../../jquery.mobile.widget", ".
//>>excludeEnd("jqmBuildExclude");
(function( $, undefined ) {
-$.widget( "mobile.slider", $.mobile.widget, {
+$.widget( "mobile.slider", $.mobile.widget, $.extend( {
widgetEventPrefix: "slide",
options: {
@@ -168,9 +168,7 @@ $.widget( "mobile.slider", $.mobile.widget, {
this.handle.bind( "vclick", false );
- if ( this._handleFormReset ) {
- this._handleFormReset();
- }
+ this._handleFormReset();
this.refresh( undefined, undefined, true );
},
@@ -503,9 +501,7 @@ $.widget( "mobile.slider", $.mobile.widget, {
return this._setOption( "disabled", true );
}
-});
-
-$.widget( "mobile.slider", $.mobile.slider, $.mobile.behaviors.formReset );
+}, $.mobile.behaviors.formReset ) );
//auto self-init widgets
$.mobile.document.bind( "pagecreate create", function( e ) {

0 comments on commit ab6dbff

Please sign in to comment.