From 6c4b1398b814e21e3853254b5fc0fb8aa7ba1edf Mon Sep 17 00:00:00 2001 From: Doug Bunting Date: Tue, 18 Nov 2014 14:17:05 -0800 Subject: [PATCH] Address small `InputTagHelper` bug discovered while testing - Type attribute value was "Type", not "type", when determined from template hints nit: remove useless condition --- .../InputTagHelper.cs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/Microsoft.AspNet.Mvc.TagHelpers/InputTagHelper.cs b/src/Microsoft.AspNet.Mvc.TagHelpers/InputTagHelper.cs index 08dd948650..e4447cf67b 100644 --- a/src/Microsoft.AspNet.Mvc.TagHelpers/InputTagHelper.cs +++ b/src/Microsoft.AspNet.Mvc.TagHelpers/InputTagHelper.cs @@ -24,7 +24,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers { { "HiddenInput", InputType.Hidden.ToString().ToLowerInvariant() }, { "Password", InputType.Password.ToString().ToLowerInvariant() }, - { "Text", InputType.Text.ToString() }, + { "Text", InputType.Text.ToString().ToLowerInvariant() }, { "PhoneNumber", "tel" }, { "Url", "url" }, { "EmailAddress", "email" }, @@ -143,6 +143,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers string inputTypeHint; if (string.IsNullOrEmpty(InputTypeName)) { + // Note GetInputType never returns null. inputType = GetInputType(metadata, out inputTypeHint); } else @@ -151,13 +152,10 @@ namespace Microsoft.AspNet.Mvc.TagHelpers inputTypeHint = null; } - if (!string.IsNullOrEmpty(inputType)) + // inputType may be more specific than default the generator chooses below. + if (!output.Attributes.ContainsKey("type")) { - // inputType may be more specific than default the generator chooses below. - if (!output.Attributes.ContainsKey("type")) - { - output.Attributes["type"] = inputType; - } + output.Attributes["type"] = inputType; } TagBuilder tagBuilder;