[Fixes #266] Maintain HTML provided case for TagHelper attributes
This commit is contained in:
parent
4d80c96f9c
commit
7bd338fc4a
|
|
@ -200,7 +200,8 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
|
||||||
if (matchingAttributes.Any())
|
if (matchingAttributes.Any())
|
||||||
{
|
{
|
||||||
// First attribute wins, even if there's duplicates.
|
// First attribute wins, even if there's duplicates.
|
||||||
var attributeValueChunk = matchingAttributes.First().Value;
|
var firstAttribute = matchingAttributes.First();
|
||||||
|
var attributeValueChunk = firstAttribute.Value;
|
||||||
|
|
||||||
var attributeValueRecorded = htmlAttributeValues.ContainsKey(attributeDescriptor.Name);
|
var attributeValueRecorded = htmlAttributeValues.ContainsKey(attributeDescriptor.Name);
|
||||||
|
|
||||||
|
|
@ -293,12 +294,13 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var attributeName = firstAttribute.Key;
|
||||||
// We need to inform the context of the attribute value.
|
// We need to inform the context of the attribute value.
|
||||||
_writer
|
_writer
|
||||||
.WriteStartInstanceMethodInvocation(
|
.WriteStartInstanceMethodInvocation(
|
||||||
ExecutionContextVariableName,
|
ExecutionContextVariableName,
|
||||||
_tagHelperContext.ExecutionContextAddTagHelperAttributeMethodName)
|
_tagHelperContext.ExecutionContextAddTagHelperAttributeMethodName)
|
||||||
.WriteStringLiteral(attributeDescriptor.Name)
|
.WriteStringLiteral(attributeName)
|
||||||
.WriteParameterSeparator()
|
.WriteParameterSeparator()
|
||||||
.Write(valueAccessor)
|
.Write(valueAccessor)
|
||||||
.WriteEndMethodInvocation();
|
.WriteEndMethodInvocation();
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#pragma checksum "ComplexTagHelpers.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "e63f87bb14f278343a07e293df68e44e88600352"
|
#pragma checksum "ComplexTagHelpers.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "5832e3fc8fa5fa77f49c7bdb26fb90a1dd2d6eb0"
|
||||||
namespace TestOutput
|
namespace TestOutput
|
||||||
{
|
{
|
||||||
using Microsoft.AspNet.Razor.Runtime.TagHelpers;
|
using Microsoft.AspNet.Razor.Runtime.TagHelpers;
|
||||||
|
|
@ -140,7 +140,7 @@ WriteLiteral(true ? "checkbox" : "anything");
|
||||||
#line hidden
|
#line hidden
|
||||||
__tagHelperStringValueBuffer = EndTagHelperWritingScope();
|
__tagHelperStringValueBuffer = EndTagHelperWritingScope();
|
||||||
__InputTagHelper.Type = __tagHelperStringValueBuffer.ToString();
|
__InputTagHelper.Type = __tagHelperStringValueBuffer.ToString();
|
||||||
__tagHelperExecutionContext.AddTagHelperAttribute("type", __InputTagHelper.Type);
|
__tagHelperExecutionContext.AddTagHelperAttribute("tYPe", __InputTagHelper.Type);
|
||||||
__InputTagHelper2 = CreateTagHelper<InputTagHelper2>();
|
__InputTagHelper2 = CreateTagHelper<InputTagHelper2>();
|
||||||
__tagHelperExecutionContext.Add(__InputTagHelper2);
|
__tagHelperExecutionContext.Add(__InputTagHelper2);
|
||||||
__InputTagHelper2.Type = __InputTagHelper.Type;
|
__InputTagHelper2.Type = __InputTagHelper.Type;
|
||||||
|
|
@ -237,7 +237,7 @@ __InputTagHelper2.Checked = @object;
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
__tagHelperExecutionContext.AddTagHelperAttribute("checked", __InputTagHelper2.Checked);
|
__tagHelperExecutionContext.AddTagHelperAttribute("ChecKED", __InputTagHelper2.Checked);
|
||||||
__tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
|
__tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
|
||||||
await WriteTagHelperAsync(__tagHelperExecutionContext);
|
await WriteTagHelperAsync(__tagHelperExecutionContext);
|
||||||
__tagHelperExecutionContext = __tagHelperScopeManager.End();
|
__tagHelperExecutionContext = __tagHelperScopeManager.End();
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ WriteLiteral(DateTime.Now);
|
||||||
#line hidden
|
#line hidden
|
||||||
__tagHelperStringValueBuffer = EndTagHelperWritingScope();
|
__tagHelperStringValueBuffer = EndTagHelperWritingScope();
|
||||||
__MyTagHelper.BoundProperty = __tagHelperStringValueBuffer.ToString();
|
__MyTagHelper.BoundProperty = __tagHelperStringValueBuffer.ToString();
|
||||||
__tagHelperExecutionContext.AddTagHelperAttribute("BoundProperty", __MyTagHelper.BoundProperty);
|
__tagHelperExecutionContext.AddTagHelperAttribute("boundproperty", __MyTagHelper.BoundProperty);
|
||||||
StartTagHelperWritingScope();
|
StartTagHelperWritingScope();
|
||||||
WriteLiteral("Current Time: ");
|
WriteLiteral("Current Time: ");
|
||||||
#line 9 "TagHelpersInSection.cshtml"
|
#line 9 "TagHelpersInSection.cshtml"
|
||||||
|
|
|
||||||
|
|
@ -14,13 +14,13 @@
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<p>Current Time: <input type=@checkbox checked=true /></p>
|
<p>Current Time: <input type=@checkbox checked=true /></p>
|
||||||
<input type='@(true ? "checkbox" : "anything")' />
|
<input tYPe='@(true ? "checkbox" : "anything")' />
|
||||||
<input type='@if(true) { <text>checkbox</text> } else { <text>anything</text> }' />
|
<input type='@if(true) { <text>checkbox</text> } else { <text>anything</text> }' />
|
||||||
}
|
}
|
||||||
</p>
|
</p>
|
||||||
<p age="@DateTimeOffset.Now.Year - 1970">
|
<p age="@DateTimeOffset.Now.Year - 1970">
|
||||||
@{ var @object = false;}
|
@{ var @object = false;}
|
||||||
<input checked="@(@object)" />
|
<input ChecKED="@(@object)" />
|
||||||
</p>
|
</p>
|
||||||
<p age="-1970 + @DateTimeOffset.Now.Year">
|
<p age="-1970 + @DateTimeOffset.Now.Year">
|
||||||
<input checked="@(DateTimeOffset.Now.Year > 2014)" />
|
<input checked="@(DateTimeOffset.Now.Year > 2014)" />
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue