Skip to content

Commit aa63dc4

Browse files
Textinput: Rewrote the disable and enable functions to improve readability.
1 parent 57f9df3 commit aa63dc4

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

js/widgets/forms/textinput.js

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,15 +138,25 @@ $.widget( "mobile.textinput", $.mobile.widget, {
138138
},
139139

140140
disable: function(){
141-
( this.element.attr( "disabled", true ).is( "[type='search'],:jqmData(type='search')" ) ?
142-
this.element.parent() : this.element ).addClass( "ui-disabled" );
143-
return this._setOption( "disabled", true );
141+
142+
if ( this.element.attr( "disabled", true ).is( "[type='search'],:jqmData(type='search')" ) ) {
143+
this.element.parent().addClass( "ui-disabled" );
144+
} else {
145+
this.element.addClass( "ui-disabled" );
146+
}
147+
return this._setOption( "disabled", true );
148+
144149
},
145150

146151
enable: function(){
147-
( this.element.attr( "disabled", false).is( "[type='search'],:jqmData(type='search')" ) ?
148-
this.element.parent() : this.element ).removeClass( "ui-disabled" );
149-
return this._setOption( "disabled", false );
152+
153+
if ( this.element.attr( "disabled", false ).is( "[type='search'],:jqmData(type='search')" ) ) {
154+
this.element.parent().removeClass( "ui-disabled" );
155+
} else {
156+
this.element.removeClass( "ui-disabled" );
157+
}
158+
return this._setOption( "disabled", false );
159+
150160
}
151161
});
152162

0 commit comments

Comments
 (0)