Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

Commit

Permalink
Form widgets: Add reset handling via $.extend, not $.widget to avoid …
Browse files Browse the repository at this point in the history
…additional subclass depth

(cherry picked from commit 871a4f8)
  • Loading branch information
Gabriel Schulhof committed Feb 26, 2013
1 parent 5bacbbc commit ab6dbff
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 21 deletions.
10 changes: 3 additions & 7 deletions js/widgets/forms/checkboxradio.js
Expand Up @@ -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,
Expand Down Expand Up @@ -136,9 +136,7 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, {
}
});

if ( this._handleFormReset ) {
this._handleFormReset();
}
this._handleFormReset();
this.refresh();
},

Expand Down Expand Up @@ -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 ) {
Expand Down
11 changes: 4 additions & 7 deletions js/widgets/forms/select.js
Expand Up @@ -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,
Expand Down Expand Up @@ -152,9 +152,8 @@ $.widget( "mobile.selectmenu", $.mobile.widget, {
self.refresh();
});

if ( this._handleFormReset ) {
this._handleFormReset();
}
this._handleFormReset();

this.build();
},

Expand Down Expand Up @@ -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 ) {
Expand Down
10 changes: 3 additions & 7 deletions js/widgets/forms/slider.js
Expand Up @@ -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: {
Expand Down Expand Up @@ -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 );
},
Expand Down Expand Up @@ -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 ) {
Expand Down

0 comments on commit ab6dbff

Please sign in to comment.