Permalink
Browse files

Textinput: Rewrote the disable and enable functions to improve readab…

…ility.
  • Loading branch information...
jaspermdegroot committed Jul 3, 2012
1 parent 57f9df3 commit aa63dc400d3f4a07c72adf4e6b0a5abae06d8b01
Showing with 16 additions and 6 deletions.
  1. +16 −6 js/widgets/forms/textinput.js
@@ -138,15 +138,25 @@ $.widget( "mobile.textinput", $.mobile.widget, {
},
disable: function(){
- ( this.element.attr( "disabled", true ).is( "[type='search'],:jqmData(type='search')" ) ?
- this.element.parent() : this.element ).addClass( "ui-disabled" );
- return this._setOption( "disabled", true );
+
+ if ( this.element.attr( "disabled", true ).is( "[type='search'],:jqmData(type='search')" ) ) {
+ this.element.parent().addClass( "ui-disabled" );
+ } else {
+ this.element.addClass( "ui-disabled" );
+ }
+ return this._setOption( "disabled", true );
+
},
enable: function(){
- ( this.element.attr( "disabled", false).is( "[type='search'],:jqmData(type='search')" ) ?
- this.element.parent() : this.element ).removeClass( "ui-disabled" );
- return this._setOption( "disabled", false );
+
+ if ( this.element.attr( "disabled", false ).is( "[type='search'],:jqmData(type='search')" ) ) {
+ this.element.parent().removeClass( "ui-disabled" );
+ } else {
+ this.element.removeClass( "ui-disabled" );
+ }
+ return this._setOption( "disabled", false );
+
}
});

1 comment on commit aa63dc4

Member

jaspermdegroot commented on aa63dc4 Jul 8, 2012

cherry-pick 1.1.2.

Please sign in to comment.