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

Commit 053f992

Browse files
Fixed the disabled styling of textinput elements.
1 parent 716f2b8 commit 053f992

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

js/widgets/forms/textinput.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,10 @@ $.widget( "mobile.textinput", $.mobile.widget, {
148148

149149
disable: function() {
150150
var $el,
151-
parentNeedsDisabled = this.element.attr( "disabled", true ) && ( this.element.is( "[type='search'], :jqmData(type='search')" ) || ( this.element.is( "[type='text'],textarea" ) && !!this.options.clearBtn ) );
151+
isSearch = this.element.is( "[type='search'], :jqmData(type='search')" ),
152+
inputNeedsWrap = this.element.is( "input" ) && !this.element.is( ":jqmData(type='range')" ),
153+
parentNeedsDisabled = this.element.attr( "disabled", true ) && ( inputNeedsWrap || isSearch );
154+
152155
if ( parentNeedsDisabled ) {
153156
$el = this.element.parent();
154157
} else {
@@ -160,9 +163,10 @@ $.widget( "mobile.textinput", $.mobile.widget, {
160163

161164
enable: function() {
162165
var $el,
163-
parentNeedsDisabled = this.element.attr( "disabled", true ) && ( this.element.is( "[type='search'], :jqmData(type='search')" ) || ( this.element.is( "[type='text'],textarea" ) && !!this.options.clearBtn ) );
166+
isSearch = this.element.is( "[type='search'], :jqmData(type='search')" ),
167+
inputNeedsWrap = this.element.is( "input" ) && !this.element.is( ":jqmData(type='range')" ),
168+
parentNeedsDisabled = this.element.attr( "disabled", true ) && ( inputNeedsWrap || isSearch );
164169

165-
// TODO using more than one line of code is acceptable ;)
166170
if ( parentNeedsDisabled ) {
167171
$el = this.element.parent();
168172
} else {

0 commit comments

Comments
 (0)