@@ -96,10 +96,13 @@ export class MatInput extends _MatInputMixinBase implements MatFormFieldControl<
9696 _ariaDescribedby : string ;
9797
9898 /** Whether the component is being rendered on the server. */
99- _isServer = false ;
99+ readonly _isServer : boolean ;
100100
101101 /** Whether the component is a native html select. */
102- _isNativeSelect = false ;
102+ readonly _isNativeSelect : boolean ;
103+
104+ /** Whether the component is a textarea. */
105+ readonly _isTextarea : boolean ;
103106
104107 /**
105108 * Implemented as part of MatFormFieldControl.
@@ -182,7 +185,7 @@ export class MatInput extends _MatInputMixinBase implements MatFormFieldControl<
182185 // When using Angular inputs, developers are no longer able to set the properties on the native
183186 // input element. To ensure that bindings for `type` work, we need to sync the setter
184187 // with the native property. Textarea elements don't support the type property or attribute.
185- if ( ! this . _isTextarea ( ) && getSupportedInputTypes ( ) . has ( this . _type ) ) {
188+ if ( ! this . _isTextarea && getSupportedInputTypes ( ) . has ( this . _type ) ) {
186189 ( this . _elementRef . nativeElement as HTMLInputElement ) . type = this . _type ;
187190 }
188191 }
@@ -234,6 +237,7 @@ export class MatInput extends _MatInputMixinBase implements MatFormFieldControl<
234237 super ( _defaultErrorStateMatcher , _parentForm , _parentFormGroup , ngControl ) ;
235238
236239 const element = this . _elementRef . nativeElement ;
240+ const nodeName = element . nodeName . toLowerCase ( ) ;
237241
238242 // If no input value accessor was explicitly specified, use the element as the input value
239243 // accessor.
@@ -264,7 +268,8 @@ export class MatInput extends _MatInputMixinBase implements MatFormFieldControl<
264268 }
265269
266270 this . _isServer = ! this . _platform . isBrowser ;
267- this . _isNativeSelect = element . nodeName . toLowerCase ( ) === 'select' ;
271+ this . _isNativeSelect = nodeName === 'select' ;
272+ this . _isTextarea = nodeName === 'textarea' ;
268273
269274 if ( this . _isNativeSelect ) {
270275 this . controlType = ( element as HTMLSelectElement ) . multiple ? 'mat-native-select-multiple' :
@@ -344,11 +349,6 @@ export class MatInput extends _MatInputMixinBase implements MatFormFieldControl<
344349 // FormsModule or ReactiveFormsModule, because Angular forms also listens to input events.
345350 }
346351
347- /** Determines if the component host is a textarea. */
348- _isTextarea ( ) {
349- return this . _elementRef . nativeElement . nodeName . toLowerCase ( ) === 'textarea' ;
350- }
351-
352352 /** Does some manual dirty checking on the native input `value` property. */
353353 protected _dirtyCheckNativeValue ( ) {
354354 const newValue = this . _elementRef . nativeElement . value ;
0 commit comments