File tree Expand file tree Collapse file tree 1 file changed +7
-9
lines changed
Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -187,20 +187,18 @@ $(function () {
187187 value = theme [ name ] ;
188188 }
189189
190- if ( typeof value === 'undefined' ) {
191- return ;
192- }
193-
194190 if ( el . tagName === 'INPUT' ) {
195- if ( $el . attr ( 'type' ) === 'checkbox' ) {
196- $el . prop ( 'checked' , value === true || value === 'true' ) ;
191+ const isCheckbox = $el . attr ( 'type' ) === 'checkbox' ;
192+ const normalized = typeof value === 'undefined' ? ( isCheckbox ? false : '' ) : value ;
193+ if ( isCheckbox ) {
194+ $el . prop ( 'checked' , normalized === true || normalized === 'true' ) ;
197195 } else {
198- $el . val ( value ) ;
196+ $el . val ( normalized ) ;
199197 }
200198 } else if ( el . tagName === 'SELECT' ) {
201- $el . val ( value ) . trigger ( 'change' ) ;
199+ $el . val ( typeof value === 'undefined' ? '' : value ) . trigger ( 'change' ) ;
202200 } else if ( el . tagName === 'TEXTAREA' ) {
203- $el . val ( value ) ;
201+ $el . val ( typeof value === 'undefined' ? '' : value ) ;
204202 }
205203
206204 $el . trigger ( 'change' ) ;
You can’t perform that action at this time.
0 commit comments