Address small `InputTagHelper` bug discovered while testing
- Type attribute value was "Type", not "type", when determined from template hints nit: remove useless condition
This commit is contained in:
parent
1b28e19114
commit
6c4b1398b8
|
|
@ -24,7 +24,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
||||||
{
|
{
|
||||||
{ "HiddenInput", InputType.Hidden.ToString().ToLowerInvariant() },
|
{ "HiddenInput", InputType.Hidden.ToString().ToLowerInvariant() },
|
||||||
{ "Password", InputType.Password.ToString().ToLowerInvariant() },
|
{ "Password", InputType.Password.ToString().ToLowerInvariant() },
|
||||||
{ "Text", InputType.Text.ToString() },
|
{ "Text", InputType.Text.ToString().ToLowerInvariant() },
|
||||||
{ "PhoneNumber", "tel" },
|
{ "PhoneNumber", "tel" },
|
||||||
{ "Url", "url" },
|
{ "Url", "url" },
|
||||||
{ "EmailAddress", "email" },
|
{ "EmailAddress", "email" },
|
||||||
|
|
@ -143,6 +143,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
||||||
string inputTypeHint;
|
string inputTypeHint;
|
||||||
if (string.IsNullOrEmpty(InputTypeName))
|
if (string.IsNullOrEmpty(InputTypeName))
|
||||||
{
|
{
|
||||||
|
// Note GetInputType never returns null.
|
||||||
inputType = GetInputType(metadata, out inputTypeHint);
|
inputType = GetInputType(metadata, out inputTypeHint);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -151,13 +152,10 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
||||||
inputTypeHint = null;
|
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.
|
output.Attributes["type"] = inputType;
|
||||||
if (!output.Attributes.ContainsKey("type"))
|
|
||||||
{
|
|
||||||
output.Attributes["type"] = inputType;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TagBuilder tagBuilder;
|
TagBuilder tagBuilder;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue