From dda1d04750060a33b003c6d461dfc2375f4386fc Mon Sep 17 00:00:00 2001 From: Kristiyan Kostadinov Date: Tue, 27 Mar 2018 18:59:01 +0200 Subject: [PATCH] fix(input): inaccurate textarea check during server-side render (#10467) A while ago we added a check to the `_isTextarea` method that accounted for the old renderer's non-standard API. These changes remove that check, because it isn't accurate anymore with the new renderer. --- src/lib/input/input.ts | 10 ++-------- src/universal-app/kitchen-sink/kitchen-sink.html | 6 +++++- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/lib/input/input.ts b/src/lib/input/input.ts index bbbcf7d1eac..8bbbf42918e 100644 --- a/src/lib/input/input.ts +++ b/src/lib/input/input.ts @@ -328,15 +328,9 @@ export class MatInput extends _MatInputMixinBase implements MatFormFieldControl< return validity && validity.badInput; } - /** Determines if the component host is a textarea. If not recognizable it returns false. */ + /** Determines if the component host is a textarea. */ protected _isTextarea() { - let nativeElement = this._elementRef.nativeElement; - - // In Universal, we don't have access to `nodeName`, but the same can be achieved with `name`. - // Note that this shouldn't be necessary once Angular switches to an API that resembles the - // DOM closer. - let nodeName = this._platform.isBrowser ? nativeElement.nodeName : nativeElement.name; - return nodeName ? nodeName.toLowerCase() === 'textarea' : false; + return this._elementRef.nativeElement.nodeName.toLowerCase() === 'textarea'; } /** diff --git a/src/universal-app/kitchen-sink/kitchen-sink.html b/src/universal-app/kitchen-sink/kitchen-sink.html index f230fd39587..0df5cf724f5 100644 --- a/src/universal-app/kitchen-sink/kitchen-sink.html +++ b/src/universal-app/kitchen-sink/kitchen-sink.html @@ -112,7 +112,11 @@

Input

- + + + + +