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

Commit

Permalink
Textinput: Rewrote the disable and enable functions to improve readab…
Browse files Browse the repository at this point in the history
…ility.
  • Loading branch information
jaspermdegroot committed Jul 3, 2012
1 parent 57f9df3 commit aa63dc4
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions js/widgets/forms/textinput.js
Expand Up @@ -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 );

}
});

Expand Down

1 comment on commit aa63dc4

@jaspermdegroot
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cherry-pick 1.1.2.

Please sign in to comment.