From 6b3e0434d69284d78fb1509f093e89c9874f0ee3 Mon Sep 17 00:00:00 2001 From: crisbeto Date: Sun, 18 Mar 2018 12:50:07 +0100 Subject: [PATCH] fix(input): inaccurate textarea check during server-side render 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 af144ed38a5a..44d03fb01733 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 f230fd39587e..0df5cf724f5f 100644 --- a/src/universal-app/kitchen-sink/kitchen-sink.html +++ b/src/universal-app/kitchen-sink/kitchen-sink.html @@ -112,7 +112,11 @@

Icon

Input

- + + + + +