diff --git a/src/Microsoft.AspNetCore.Razor.Runtime/Runtime/TagHelpers/TagHelperExecutionContext.cs b/src/Microsoft.AspNetCore.Razor.Runtime/Runtime/TagHelpers/TagHelperExecutionContext.cs index fda0854e6..e299b051c 100644 --- a/src/Microsoft.AspNetCore.Razor.Runtime/Runtime/TagHelpers/TagHelperExecutionContext.cs +++ b/src/Microsoft.AspNetCore.Razor.Runtime/Runtime/TagHelpers/TagHelperExecutionContext.cs @@ -138,34 +138,20 @@ public void Add(ITagHelper tagHelper) _tagHelpers.Add(tagHelper); } - /// - /// Tracks the minimized HTML attribute. - /// - /// The minimized HTML attribute name. - public void AddMinimizedHtmlAttribute(string name) - { - if (name == null) - { - throw new ArgumentNullException(nameof(name)); - } - - var attribute = new TagHelperAttribute(name); - AddHtmlAttribute(attribute); - } - /// /// Tracks the HTML attribute. /// /// The HTML attribute name. /// The HTML attribute value. - public void AddHtmlAttribute(string name, object value) + /// The value style of the attribute. + public void AddHtmlAttribute(string name, object value, HtmlAttributeValueStyle valueStyle) { if (name == null) { throw new ArgumentNullException(nameof(name)); } - var attribute = new TagHelperAttribute(name, value); + var attribute = new TagHelperAttribute(name, value, valueStyle); AddHtmlAttribute(attribute); } @@ -189,15 +175,16 @@ public void AddHtmlAttribute(TagHelperAttribute attribute) /// /// The bound attribute name. /// The attribute value. - public void AddTagHelperAttribute(string name, object value) + /// The value style of the attribute. + public void AddTagHelperAttribute(string name, object value, HtmlAttributeValueStyle valueStyle) { if (name == null) { throw new ArgumentNullException(nameof(name)); } - - _allAttributes.Add(name, value); + var attribute = new TagHelperAttribute(name, value, valueStyle); + _allAttributes.Add(attribute); } /// diff --git a/src/Microsoft.AspNetCore.Razor.Runtime/TagHelpers/TagHelperAttribute.cs b/src/Microsoft.AspNetCore.Razor.Runtime/TagHelpers/TagHelperAttribute.cs index 259e428d5..f23318041 100644 --- a/src/Microsoft.AspNetCore.Razor.Runtime/TagHelpers/TagHelperAttribute.cs +++ b/src/Microsoft.AspNetCore.Razor.Runtime/TagHelpers/TagHelperAttribute.cs @@ -2,6 +2,9 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; +using System.IO; +using System.Text.Encodings.Web; +using Microsoft.AspNetCore.Html; using Microsoft.Extensions.Internal; namespace Microsoft.AspNetCore.Razor.TagHelpers @@ -9,39 +12,40 @@ namespace Microsoft.AspNetCore.Razor.TagHelpers /// /// An HTML tag helper attribute. /// - public class TagHelperAttribute + public class TagHelperAttribute : IHtmlContentContainer { /// /// Instantiates a new instance of with the specified . - /// is set to true and to null. + /// is set to and to + /// null. /// /// The of the attribute. public TagHelperAttribute(string name) - : this(name, value: null, minimized: true) + : this(name, value: null, valueStyle: HtmlAttributeValueStyle.Minimized) { } /// /// Instantiates a new instance of with the specified - /// and . is set to false. + /// and . is set to . /// /// The of the attribute. /// The of the attribute. public TagHelperAttribute(string name, object value) - : this(name, value, minimized: false) + : this(name, value, valueStyle: HtmlAttributeValueStyle.DoubleQuotes) { } /// /// Instantiates a new instance of with the specified , - /// and . + /// and . /// /// The of the new instance. /// The of the new instance. - /// The value of the new instance. - /// If is true, is ignored when this - /// instance is rendered. - public TagHelperAttribute(string name, object value, bool minimized) + /// The of the new instance. + /// If is , + /// is ignored when this instance is rendered. + public TagHelperAttribute(string name, object value, HtmlAttributeValueStyle valueStyle) { if (name == null) { @@ -50,7 +54,7 @@ public TagHelperAttribute(string name, object value, bool minimized) Name = name; Value = value; - Minimized = minimized; + ValueStyle = valueStyle; } /// @@ -64,11 +68,9 @@ public TagHelperAttribute(string name, object value, bool minimized) public object Value { get; } /// - /// Gets an indication whether the attribute is minimized or not. + /// Gets the value style of the attribute. /// - /// If true, will be ignored. - public bool Minimized { get; } - + public HtmlAttributeValueStyle ValueStyle { get; } /// /// is compared case-insensitively. @@ -77,8 +79,147 @@ public bool Equals(TagHelperAttribute other) return other != null && string.Equals(Name, other.Name, StringComparison.OrdinalIgnoreCase) && - Minimized == other.Minimized && - (Minimized || Equals(Value, other.Value)); + ValueStyle == other.ValueStyle && + (ValueStyle == HtmlAttributeValueStyle.Minimized || Equals(Value, other.Value)); + } + + /// + public void WriteTo(TextWriter writer, HtmlEncoder encoder) + { + if (writer == null) + { + throw new ArgumentNullException(nameof(writer)); + } + + if (encoder == null) + { + throw new ArgumentNullException(nameof(encoder)); + } + + writer.Write(Name); + + if (ValueStyle == HtmlAttributeValueStyle.Minimized) + { + return; + } + + var valuePrefix = GetAttributeValuePrefix(ValueStyle); + if (valuePrefix != null) + { + writer.Write(valuePrefix); + } + + var htmlContent = Value as IHtmlContent; + if (htmlContent != null) + { + htmlContent.WriteTo(writer, encoder); + } + else if (Value != null) + { + encoder.Encode(writer, Value.ToString()); + } + + var valueSuffix = GetAttributeValueSuffix(ValueStyle); + if (valueSuffix != null) + { + writer.Write(valueSuffix); + } + } + + /// + public void CopyTo(IHtmlContentBuilder destination) + { + if (destination == null) + { + throw new ArgumentNullException(nameof(destination)); + } + + destination.AppendHtml(Name); + + if (ValueStyle == HtmlAttributeValueStyle.Minimized) + { + return; + } + + var valuePrefix = GetAttributeValuePrefix(ValueStyle); + if (valuePrefix != null) + { + destination.AppendHtml(valuePrefix); + } + + string valueAsString; + IHtmlContentContainer valueAsHtmlContainer; + IHtmlContent valueAsHtmlContent; + if ((valueAsString = Value as string) != null) + { + destination.Append(valueAsString); + } + else if ((valueAsHtmlContainer = Value as IHtmlContentContainer) != null) + { + valueAsHtmlContainer.CopyTo(destination); + } + else if ((valueAsHtmlContent = Value as IHtmlContent) != null) + { + destination.AppendHtml(valueAsHtmlContent); + } + else if (Value != null) + { + destination.Append(Value.ToString()); + } + + var valueSuffix = GetAttributeValueSuffix(ValueStyle); + if (valueSuffix != null) + { + destination.AppendHtml(valueSuffix); + } + } + + /// + public void MoveTo(IHtmlContentBuilder destination) + { + if (destination == null) + { + throw new ArgumentNullException(nameof(destination)); + } + + destination.AppendHtml(Name); + + if (ValueStyle == HtmlAttributeValueStyle.Minimized) + { + return; + } + + var valuePrefix = GetAttributeValuePrefix(ValueStyle); + if (valuePrefix != null) + { + destination.AppendHtml(valuePrefix); + } + + string valueAsString; + IHtmlContentContainer valueAsHtmlContainer; + IHtmlContent valueAsHtmlContent; + if ((valueAsString = Value as string) != null) + { + destination.Append(valueAsString); + } + else if ((valueAsHtmlContainer = Value as IHtmlContentContainer) != null) + { + valueAsHtmlContainer.MoveTo(destination); + } + else if ((valueAsHtmlContent = Value as IHtmlContent) != null) + { + destination.AppendHtml(valueAsHtmlContent); + } + else if (Value != null) + { + destination.Append(Value.ToString()); + } + + var valueSuffix = GetAttributeValueSuffix(ValueStyle); + if (valueSuffix != null) + { + destination.AppendHtml(valueSuffix); + } } /// @@ -94,10 +235,43 @@ public override int GetHashCode() { var hashCodeCombiner = HashCodeCombiner.Start(); hashCodeCombiner.Add(Name, StringComparer.Ordinal); - hashCodeCombiner.Add(Value); - hashCodeCombiner.Add(Minimized); + + if (ValueStyle != HtmlAttributeValueStyle.Minimized) + { + hashCodeCombiner.Add(Value); + } + + hashCodeCombiner.Add(ValueStyle); return hashCodeCombiner.CombinedHash; } + + private static string GetAttributeValuePrefix(HtmlAttributeValueStyle valueStyle) + { + switch (valueStyle) + { + case HtmlAttributeValueStyle.DoubleQuotes: + return "=\""; + case HtmlAttributeValueStyle.SingleQuotes: + return "='"; + case HtmlAttributeValueStyle.NoQuotes: + return "="; + } + + return null; + } + + private static string GetAttributeValueSuffix(HtmlAttributeValueStyle valueStyle) + { + switch (valueStyle) + { + case HtmlAttributeValueStyle.DoubleQuotes: + return "\""; + case HtmlAttributeValueStyle.SingleQuotes: + return "'"; + } + + return null; + } } } \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Razor.Runtime/TagHelpers/TagHelperOutput.cs b/src/Microsoft.AspNetCore.Razor.Runtime/TagHelpers/TagHelperOutput.cs index b49718bca..14de47467 100644 --- a/src/Microsoft.AspNetCore.Razor.Runtime/TagHelpers/TagHelperOutput.cs +++ b/src/Microsoft.AspNetCore.Razor.Runtime/TagHelpers/TagHelperOutput.cs @@ -2,6 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; +using System.Diagnostics; using System.IO; using System.Text.Encodings.Web; using System.Threading.Tasks; @@ -305,7 +306,13 @@ void IHtmlContentContainer.CopyTo(IHtmlContentBuilder destination) destination.AppendHtml("<"); destination.AppendHtml(TagName); - CopyAttributesTo(destination); + // Perf: Avoid allocating enumerator + for (var i = 0; i < Attributes.Count; i++) + { + var attribute = Attributes[i]; + destination.AppendHtml(" "); + attribute.CopyTo(destination); + } if (TagMode == TagMode.SelfClosing) { @@ -350,7 +357,13 @@ void IHtmlContentContainer.MoveTo(IHtmlContentBuilder destination) destination.AppendHtml("<"); destination.AppendHtml(TagName); - CopyAttributesTo(destination); + // Perf: Avoid allocating enumerator + for (var i = 0; i < Attributes.Count; i++) + { + var attribute = Attributes[i]; + destination.AppendHtml(" "); + attribute.MoveTo(destination); + } if (TagMode == TagMode.SelfClosing) { @@ -405,49 +418,11 @@ public void WriteTo(TextWriter writer, HtmlEncoder encoder) writer.Write(TagName); // Perf: Avoid allocating enumerator - for (var i = 0; i < (Attributes.Count); i++) + for (var i = 0; i < Attributes.Count; i++) { var attribute = Attributes[i]; writer.Write(" "); - writer.Write(attribute.Name); - - if (attribute.Minimized) - { - continue; - } - - writer.Write("=\""); - var value = attribute.Value; - var htmlContent = value as IHtmlContent; - if (htmlContent != null) - { - // Perf: static text in a bound attribute go down this path. Avoid allocating if possible (common case). - var htmlString = value as HtmlString; - if (htmlString != null && !htmlString.Value.Contains("\"")) - { - writer.Write(htmlString.Value); - } - else - { - // There's no way of tracking the attribute value quotations in the Razor source. Therefore, we - // must escape any IHtmlContent double quote values in the case that a user wrote: - //

- using (var stringWriter = new StringWriter()) - { - htmlContent.WriteTo(stringWriter, encoder); - stringWriter.GetStringBuilder().Replace("\"", """); - - var stringValue = stringWriter.ToString(); - writer.Write(stringValue); - } - } - } - else if (value != null) - { - encoder.Encode(writer, value.ToString()); - } - - writer.Write("\""); + attribute.WriteTo(writer, encoder); } if (TagMode == TagMode.SelfClosing) @@ -476,76 +451,5 @@ public void WriteTo(TextWriter writer, HtmlEncoder encoder) _postElement?.WriteTo(writer, encoder); } - - private void CopyAttributesTo(IHtmlContentBuilder destination) - { - StringWriter stringWriter = null; - - // Perf: Avoid allocating enumerator - for (var i = 0; i < (Attributes.Count); i++) - { - var attribute = Attributes[i]; - destination.AppendHtml(" "); - destination.AppendHtml(attribute.Name); - - if (attribute.Minimized) - { - continue; - } - - destination.AppendHtml("=\""); - var value = attribute.Value; - var htmlContent = value as IHtmlContent; - if (htmlContent != null) - { - // Perf: static text in a bound attribute go down this path. Avoid allocating if possible (common case). - var htmlString = value as HtmlString; - if (htmlString != null && !htmlString.Value.Contains("\"")) - { - destination.AppendHtml(htmlString); - } - else - { - // Perf: We'll share this writer implementation for all attributes since - // they can't nest. - stringWriter = stringWriter ?? new StringWriter(); - - destination.AppendHtml(new AttributeContent(htmlContent, stringWriter)); - } - } - else if (value != null) - { - destination.Append(value.ToString()); - } - - destination.AppendHtml("\""); - } - } - - private class AttributeContent : IHtmlContent - { - private readonly IHtmlContent _inner; - private readonly StringWriter _stringWriter; - - public AttributeContent(IHtmlContent inner, StringWriter stringWriter) - { - _inner = inner; - _stringWriter = stringWriter; - } - - public void WriteTo(TextWriter writer, HtmlEncoder encoder) - { - // There's no way of tracking the attribute value quotations in the Razor source. Therefore, we - // must escape any IHtmlContent double quote values in the case that a user wrote: - //

- _inner.WriteTo(_stringWriter, encoder); - _stringWriter.GetStringBuilder().Replace("\"", """); - - var stringValue = _stringWriter.ToString(); - writer.Write(stringValue); - - _stringWriter.GetStringBuilder().Clear(); - } - } } } diff --git a/src/Microsoft.AspNetCore.Razor/Chunks/Generators/TagHelperChunkGenerator.cs b/src/Microsoft.AspNetCore.Razor/Chunks/Generators/TagHelperChunkGenerator.cs index b59baafc1..87b8d1789 100644 --- a/src/Microsoft.AspNetCore.Razor/Chunks/Generators/TagHelperChunkGenerator.cs +++ b/src/Microsoft.AspNetCore.Razor/Chunks/Generators/TagHelperChunkGenerator.cs @@ -44,7 +44,7 @@ public override void GenerateStartParentChunk(Block target, ChunkGeneratorContex tagHelperBlock != null, $"A {nameof(TagHelperChunkGenerator)} must only be used with {nameof(TagHelperBlock)}s."); - var attributes = new List>(); + var attributes = new List(); // We need to create a chunk generator to create chunks for each of the attributes. var chunkGenerator = context.Host.CreateChunkGenerator( @@ -72,7 +72,12 @@ public override void GenerateStartParentChunk(Block target, ChunkGeneratorContex }; } - attributes.Add(new KeyValuePair(attribute.Key, attributeChunkValue)); + var attributeChunk = new TagHelperAttributeTracker( + attribute.Name, + attributeChunkValue, + attribute.ValueStyle); + + attributes.Add(attributeChunk); // Reset the chunk tree builder so we can build a new one for the next attribute chunkGenerator.Context.ChunkTreeBuilder = new ChunkTreeBuilder(); diff --git a/src/Microsoft.AspNetCore.Razor/Chunks/TagHelperAttributeChunk.cs b/src/Microsoft.AspNetCore.Razor/Chunks/TagHelperAttributeChunk.cs new file mode 100644 index 000000000..a19d61f25 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor/Chunks/TagHelperAttributeChunk.cs @@ -0,0 +1,23 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using Microsoft.AspNetCore.Razor.TagHelpers; + +namespace Microsoft.AspNetCore.Razor.Chunks +{ + public struct TagHelperAttributeTracker + { + public TagHelperAttributeTracker(string name, Chunk value, HtmlAttributeValueStyle valueStyle) + { + Name = name; + Value = value; + ValueStyle = valueStyle; + } + + public string Name { get; } + + public Chunk Value { get; } + + public HtmlAttributeValueStyle ValueStyle { get; } + } +} diff --git a/src/Microsoft.AspNetCore.Razor/Chunks/TagHelperChunk.cs b/src/Microsoft.AspNetCore.Razor/Chunks/TagHelperChunk.cs index 87564839a..1cb4c6903 100644 --- a/src/Microsoft.AspNetCore.Razor/Chunks/TagHelperChunk.cs +++ b/src/Microsoft.AspNetCore.Razor/Chunks/TagHelperChunk.cs @@ -24,7 +24,7 @@ public class TagHelperChunk : ParentChunk public TagHelperChunk( string tagName, TagMode tagMode, - IList> attributes, + IList attributes, IEnumerable descriptors) { TagName = tagName; @@ -36,11 +36,7 @@ public TagHelperChunk( /// /// The HTML attributes. /// - /// - /// These attributes are => so attribute values can consist - /// of all sorts of Razor specific pieces. - /// - public IList> Attributes { get; set; } + public IList Attributes { get; set; } /// /// The s that are associated with the tag helpers HTML element. diff --git a/src/Microsoft.AspNetCore.Razor/CodeGenerators/CSharpTagHelperCodeRenderer.cs b/src/Microsoft.AspNetCore.Razor/CodeGenerators/CSharpTagHelperCodeRenderer.cs index f365f1124..65e54819e 100644 --- a/src/Microsoft.AspNetCore.Razor/CodeGenerators/CSharpTagHelperCodeRenderer.cs +++ b/src/Microsoft.AspNetCore.Razor/CodeGenerators/CSharpTagHelperCodeRenderer.cs @@ -227,7 +227,7 @@ private void RenderTagHelpersCreation( foreach (var chunkAttribute in chunk.Attributes) { var associatedAttributeDescriptor = tagHelperDescriptor.Attributes.FirstOrDefault( - attributeDescriptor => attributeDescriptor.IsNameMatch(chunkAttribute.Key)); + attributeDescriptor => attributeDescriptor.IsNameMatch(chunkAttribute.Name)); if (associatedAttributeDescriptor != null && associatedAttributeDescriptor.IsIndexer && @@ -248,7 +248,7 @@ private void RenderTagHelpersCreation( .Write("throw ") .WriteStartNewObject(nameof(InvalidOperationException)) .WriteStartMethodInvocation(_tagHelperContext.FormatInvalidIndexerAssignmentMethodName) - .WriteStringLiteral(chunkAttribute.Key) + .WriteStringLiteral(chunkAttribute.Name) .WriteParameterSeparator() .WriteStringLiteral(tagHelperDescriptor.TypeName) .WriteParameterSeparator() @@ -262,7 +262,7 @@ private void RenderTagHelpersCreation( } private void RenderAttributes( - IList> chunkAttributes, + IList chunkAttributes, IEnumerable tagHelperDescriptors) { var renderedBoundAttributeNames = new HashSet(StringComparer.OrdinalIgnoreCase); @@ -271,14 +271,13 @@ private void RenderAttributes( // TagHelperExecutionContext.HtmlAttributes' as we go. foreach (var attribute in chunkAttributes) { - var attributeName = attribute.Key; var attributeValueChunk = attribute.Value; var associatedDescriptors = tagHelperDescriptors.Where(descriptor => - descriptor.Attributes.Any(attributeDescriptor => attributeDescriptor.IsNameMatch(attributeName))); + descriptor.Attributes.Any(attributeDescriptor => attributeDescriptor.IsNameMatch(attribute.Name))); // Bound attributes have associated descriptors. First attribute value wins if there are duplicates; // later values of duplicate bound attributes are treated as if they were unbound. - if (associatedDescriptors.Any() && renderedBoundAttributeNames.Add(attributeName)) + if (associatedDescriptors.Any() && renderedBoundAttributeNames.Add(attribute.Name)) { if (attributeValueChunk == null) { @@ -294,12 +293,11 @@ private void RenderAttributes( foreach (var associatedDescriptor in associatedDescriptors) { var associatedAttributeDescriptor = associatedDescriptor.Attributes.First( - attributeDescriptor => attributeDescriptor.IsNameMatch(attributeName)); + attributeDescriptor => attributeDescriptor.IsNameMatch(attribute.Name)); var tagHelperVariableName = GetVariableName(associatedDescriptor); valueAccessor = RenderBoundAttribute( - attributeName, - attributeValueChunk, + attribute, tagHelperVariableName, valueAccessor, associatedAttributeDescriptor); @@ -307,14 +305,13 @@ private void RenderAttributes( } else { - RenderUnboundAttribute(attributeName, attributeValueChunk); + RenderUnboundAttribute(attribute); } } } private string RenderBoundAttribute( - string attributeName, - Chunk attributeValueChunk, + TagHelperAttributeTracker attribute, string tagHelperVariableName, string previousValueAccessor, TagHelperAttributeDescriptor attributeDescriptor) @@ -327,7 +324,7 @@ private string RenderBoundAttribute( if (attributeDescriptor.IsIndexer) { - var dictionaryKey = attributeName.Substring(attributeDescriptor.Name.Length); + var dictionaryKey = attribute.Name.Substring(attributeDescriptor.Name.Length); currentValueAccessor += $"[\"{dictionaryKey}\"]"; } @@ -342,7 +339,7 @@ private string RenderBoundAttribute( RenderNewAttributeValueAssignment( attributeDescriptor, bufferableAttribute, - attributeValueChunk, + attribute.Value, currentValueAccessor); if (_designTimeMode) @@ -356,9 +353,11 @@ private string RenderBoundAttribute( .WriteStartInstanceMethodInvocation( ExecutionContextVariableName, _tagHelperContext.ExecutionContextAddTagHelperAttributeMethodName) - .WriteStringLiteral(attributeName) + .WriteStringLiteral(attribute.Name) .WriteParameterSeparator() .Write(currentValueAccessor) + .WriteParameterSeparator() + .Write($"global::{typeof(HtmlAttributeValueStyle).FullName}.{attribute.ValueStyle}") .WriteEndMethodInvocation(); return currentValueAccessor; @@ -450,112 +449,93 @@ private void RenderNewAttributeValueAssignment( } } - private void RenderUnboundAttribute(string attributeName, Chunk attributeValueChunk) + private void RenderUnboundAttribute(TagHelperAttributeTracker attribute) { // Render children to provide IntelliSense at design time. No need for the execution context logic, it's // a runtime feature. if (_designTimeMode) { - if (attributeValueChunk != null) + if (attribute.Value != null) { - _bodyVisitor.Accept(attributeValueChunk); + _bodyVisitor.Accept(attribute.Value); } return; } - // If we have a minimized attribute there is no value - if (attributeValueChunk == null) - { - _writer - .WriteStartInstanceMethodInvocation( - ExecutionContextVariableName, - _tagHelperContext.ExecutionContextAddMinimizedHtmlAttributeMethodName) - .WriteStringLiteral(attributeName) - .WriteEndMethodInvocation(); - } - else if (attributeValueChunk is PreallocatedTagHelperAttributeChunk) + Debug.Assert(attribute.Value != null); + + var attributeValueStyleParameter = $"global::{typeof(HtmlAttributeValueStyle).FullName}.{attribute.ValueStyle}"; + + // All simple text and minimized attributes will be pre-allocated. + var preallocatedValue = attribute.Value as PreallocatedTagHelperAttributeChunk; + if (preallocatedValue != null) { _writer .WriteStartInstanceMethodInvocation( ExecutionContextVariableName, _tagHelperContext.ExecutionContextAddHtmlAttributeMethodName) - .Write(((PreallocatedTagHelperAttributeChunk)attributeValueChunk).AttributeVariableAccessor) + .Write(preallocatedValue.AttributeVariableAccessor) .WriteEndMethodInvocation(); } - else + else if (IsDynamicAttributeValue(attribute.Value)) { - string textValue = null; - var isPlainTextValue = TryGetPlainTextValue(attributeValueChunk, out textValue); + // Dynamic attribute value should be run through the conditional attribute removal system. It's + // unbound and contains C#. - if (isPlainTextValue) - { - // If it's a plain text value then we need to surround the value with quotes. - _writer - .WriteStartInstanceMethodInvocation( - ExecutionContextVariableName, - _tagHelperContext.ExecutionContextAddHtmlAttributeMethodName) - .WriteStringLiteral(attributeName) - .WriteParameterSeparator() - .WriteStartMethodInvocation(_tagHelperContext.MarkAsHtmlEncodedMethodName) - .WriteStringLiteral(textValue) - .WriteEndMethodInvocation(endLine: false) - .WriteEndMethodInvocation(); - } - else if (IsDynamicAttributeValue(attributeValueChunk)) - { - // Dynamic attribute value should be run through the conditional attribute removal system. It's - // unbound and contains C#. - - // TagHelper attribute rendering is buffered by default. We do not want to write to the current - // writer. - var currentTargetWriter = _context.TargetWriterName; - var currentWriteAttributeMethodName = _context.Host.GeneratedClassContext.WriteAttributeValueMethodName; - _context.TargetWriterName = null; + // TagHelper attribute rendering is buffered by default. We do not want to write to the current + // writer. + var currentTargetWriter = _context.TargetWriterName; + var currentWriteAttributeMethodName = _context.Host.GeneratedClassContext.WriteAttributeValueMethodName; + _context.TargetWriterName = null; - Debug.Assert(attributeValueChunk is ParentChunk); - var children = ((ParentChunk)attributeValueChunk).Children; - var attributeCount = children.Count(c => c is DynamicCodeAttributeChunk || c is LiteralCodeAttributeChunk); + Debug.Assert(attribute.Value is ParentChunk); + var children = ((ParentChunk)attribute.Value).Children; + var attributeCount = children.Count(c => c is DynamicCodeAttributeChunk || c is LiteralCodeAttributeChunk); - _writer - .WriteStartMethodInvocation(_tagHelperContext.BeginAddHtmlAttributeValuesMethodName) - .Write(ExecutionContextVariableName) - .WriteParameterSeparator() - .WriteStringLiteral(attributeName) - .WriteParameterSeparator() - .Write(attributeCount.ToString(CultureInfo.InvariantCulture)) - .WriteEndMethodInvocation(); + _writer + .WriteStartMethodInvocation(_tagHelperContext.BeginAddHtmlAttributeValuesMethodName) + .Write(ExecutionContextVariableName) + .WriteParameterSeparator() + .WriteStringLiteral(attribute.Name) + .WriteParameterSeparator() + .Write(attributeCount.ToString(CultureInfo.InvariantCulture)) + .WriteParameterSeparator() + .Write(attributeValueStyleParameter) + .WriteEndMethodInvocation(); - _attributeCodeVisitor.Accept(attributeValueChunk); + _attributeCodeVisitor.Accept(attribute.Value); - _writer.WriteMethodInvocation( - _tagHelperContext.EndAddHtmlAttributeValuesMethodName, - ExecutionContextVariableName); + _writer.WriteMethodInvocation( + _tagHelperContext.EndAddHtmlAttributeValuesMethodName, + ExecutionContextVariableName); - _context.TargetWriterName = currentTargetWriter; - } - else - { - // HTML attributes are always strings. This attribute contains C# but is not dynamic. This occurs - // when the attribute is a data-* attribute. + _context.TargetWriterName = currentTargetWriter; + } + else + { + // This is a data-* attribute which includes C#. Do not perform the conditional attribute removal or + // other special cases used when IsDynamicAttributeValue(). But the attribute must still be buffered to + // determine its final value. - // Attribute value is not plain text, must be buffered to determine its final value. - BuildBufferedWritingScope(attributeValueChunk, htmlEncodeValues: true); + // Attribute value is not plain text, must be buffered to determine its final value. + BuildBufferedWritingScope(attribute.Value, htmlEncodeValues: true); - _writer - .WriteStartInstanceMethodInvocation( - ExecutionContextVariableName, - _tagHelperContext.ExecutionContextAddHtmlAttributeMethodName) - .WriteStringLiteral(attributeName) - .WriteParameterSeparator() - .WriteStartMethodInvocation(_tagHelperContext.MarkAsHtmlEncodedMethodName); + _writer + .WriteStartInstanceMethodInvocation( + ExecutionContextVariableName, + _tagHelperContext.ExecutionContextAddHtmlAttributeMethodName) + .WriteStringLiteral(attribute.Name) + .WriteParameterSeparator() + .WriteStartMethodInvocation(_tagHelperContext.MarkAsHtmlEncodedMethodName); - RenderBufferedAttributeValueAccessor(_writer); + RenderBufferedAttributeValueAccessor(_writer); - _writer - .WriteEndMethodInvocation(endLine: false) - .WriteEndMethodInvocation(); - } + _writer + .WriteEndMethodInvocation(endLine: false) + .WriteParameterSeparator() + .Write(attributeValueStyleParameter) + .WriteEndMethodInvocation(); } } diff --git a/src/Microsoft.AspNetCore.Razor/CodeGenerators/GeneratedTagHelperContext.cs b/src/Microsoft.AspNetCore.Razor/CodeGenerators/GeneratedTagHelperContext.cs index c63dd81b1..df9b48158 100644 --- a/src/Microsoft.AspNetCore.Razor/CodeGenerators/GeneratedTagHelperContext.cs +++ b/src/Microsoft.AspNetCore.Razor/CodeGenerators/GeneratedTagHelperContext.cs @@ -22,7 +22,6 @@ public GeneratedTagHelperContext() ScopeManagerEndMethodName = "End"; ExecutionContextAddMethodName = "Add"; ExecutionContextAddTagHelperAttributeMethodName = "AddTagHelperAttribute"; - ExecutionContextAddMinimizedHtmlAttributeMethodName = "AddMinimizedHtmlAttribute"; ExecutionContextAddHtmlAttributeMethodName = "AddHtmlAttribute"; ExecutionContextOutputPropertyName = "Output"; FormatInvalidIndexerAssignmentMethodName = "FormatInvalidIndexerAssignment"; @@ -113,11 +112,6 @@ public GeneratedTagHelperContext() /// public string ExecutionContextAddTagHelperAttributeMethodName { get; set; } - /// - /// The name of the method used to add minimized HTML attributes. - /// - public string ExecutionContextAddMinimizedHtmlAttributeMethodName { get; set; } - /// /// The name of the method used to add HTML attributes. /// diff --git a/src/Microsoft.AspNetCore.Razor/CodeGenerators/Visitors/CSharpTagHelperFieldDeclarationVisitor.cs b/src/Microsoft.AspNetCore.Razor/CodeGenerators/Visitors/CSharpTagHelperFieldDeclarationVisitor.cs index 8f4f7c97b..24333817a 100644 --- a/src/Microsoft.AspNetCore.Razor/CodeGenerators/Visitors/CSharpTagHelperFieldDeclarationVisitor.cs +++ b/src/Microsoft.AspNetCore.Razor/CodeGenerators/Visitors/CSharpTagHelperFieldDeclarationVisitor.cs @@ -3,8 +3,10 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using Microsoft.AspNetCore.Razor.Chunks; +using Microsoft.AspNetCore.Razor.TagHelpers; using Microsoft.Extensions.Internal; namespace Microsoft.AspNetCore.Razor.CodeGenerators.Visitors @@ -107,16 +109,18 @@ private void PreAllocateUnboundTagHelperAttributes(TagHelperChunk chunk) { var attribute = chunk.Attributes[i]; var hasAssociatedDescriptors = chunk.Descriptors.Any(descriptor => - descriptor.Attributes.Any(attributeDescriptor => attributeDescriptor.IsNameMatch(attribute.Key))); + descriptor.Attributes.Any(attributeDescriptor => attributeDescriptor.IsNameMatch(attribute.Name))); // If there's no descriptors associated or we're hitting a bound attribute a second time. - if (!hasAssociatedDescriptors || !boundAttributes.Add(attribute.Key)) + if (!hasAssociatedDescriptors || !boundAttributes.Add(attribute.Name)) { string preAllocatedAttributeVariableName = null; - if (attribute.Value == null) + if (attribute.ValueStyle == HtmlAttributeValueStyle.Minimized) { - var preAllocatedAttributeKey = new TagHelperAttributeKey(attribute.Key, value: null); + Debug.Assert(attribute.Value == null); + + var preAllocatedAttributeKey = new TagHelperAttributeKey(attribute.Name, value: null, valueStyle: attribute.ValueStyle); if (TryCachePreallocatedVariableName(preAllocatedAttributeKey, out preAllocatedAttributeVariableName)) { Writer @@ -126,16 +130,18 @@ private void PreAllocateUnboundTagHelperAttributes(TagHelperChunk chunk) .Write(preAllocatedAttributeVariableName) .Write(" = ") .WriteStartNewObject("global::" + _tagHelperContext.TagHelperAttributeTypeName) - .WriteStringLiteral(attribute.Key) + .WriteStringLiteral(attribute.Name) .WriteEndMethodInvocation(); } } else { + Debug.Assert(attribute.Value != null); + string plainText; if (CSharpTagHelperCodeRenderer.TryGetPlainTextValue(attribute.Value, out plainText)) { - var preAllocatedAttributeKey = new TagHelperAttributeKey(attribute.Key, plainText); + var preAllocatedAttributeKey = new TagHelperAttributeKey(attribute.Name, plainText, attribute.ValueStyle); if (TryCachePreallocatedVariableName(preAllocatedAttributeKey, out preAllocatedAttributeVariableName)) { Writer @@ -145,11 +151,13 @@ private void PreAllocateUnboundTagHelperAttributes(TagHelperChunk chunk) .Write(preAllocatedAttributeVariableName) .Write(" = ") .WriteStartNewObject("global::" + _tagHelperContext.TagHelperAttributeTypeName) - .WriteStringLiteral(attribute.Key) + .WriteStringLiteral(attribute.Name) .WriteParameterSeparator() .WriteStartNewObject("global::" + _tagHelperContext.EncodedHtmlStringTypeName) .WriteStringLiteral(plainText) .WriteEndMethodInvocation(endLine: false) + .WriteParameterSeparator() + .Write($"global::{typeof(HtmlAttributeValueStyle).FullName}.{attribute.ValueStyle}") .WriteEndMethodInvocation(); } } @@ -157,12 +165,13 @@ private void PreAllocateUnboundTagHelperAttributes(TagHelperChunk chunk) if (preAllocatedAttributeVariableName != null) { - chunk.Attributes[i] = new KeyValuePair( - attribute.Key, + chunk.Attributes[i] = new TagHelperAttributeTracker( + attribute.Name, new PreallocatedTagHelperAttributeChunk { AttributeVariableAccessor = preAllocatedAttributeVariableName - }); + }, + attribute.ValueStyle); } } } @@ -215,21 +224,25 @@ private void WritePrivateField(string type, string name, string value) private struct TagHelperAttributeKey : IEquatable { - public TagHelperAttributeKey(string name, string value) + public TagHelperAttributeKey(string name, string value, HtmlAttributeValueStyle valueStyle) { Name = name; Value = value; + ValueStyle = valueStyle; } public string Name { get; } public string Value { get; } + public HtmlAttributeValueStyle ValueStyle { get; } + public override int GetHashCode() { var hashCodeCombiner = HashCodeCombiner.Start(); hashCodeCombiner.Add(Name, StringComparer.Ordinal); hashCodeCombiner.Add(Value, StringComparer.Ordinal); + hashCodeCombiner.Add(ValueStyle); return hashCodeCombiner.CombinedHash; } @@ -249,7 +262,8 @@ public override bool Equals(object obj) public bool Equals(TagHelperAttributeKey other) { return string.Equals(Name, other.Name, StringComparison.Ordinal) && - string.Equals(Value, other.Value, StringComparison.Ordinal); + string.Equals(Value, other.Value, StringComparison.Ordinal) && + ValueStyle == other.ValueStyle; } } } diff --git a/src/Microsoft.AspNetCore.Razor/Parser/TagHelpers/TagHelperAttributeNode.cs b/src/Microsoft.AspNetCore.Razor/Parser/TagHelpers/TagHelperAttributeNode.cs new file mode 100644 index 000000000..22a69eb0b --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor/Parser/TagHelpers/TagHelperAttributeNode.cs @@ -0,0 +1,30 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using Microsoft.AspNetCore.Razor.Parser.SyntaxTree; +using Microsoft.AspNetCore.Razor.TagHelpers; + +namespace Microsoft.AspNetCore.Razor.Parser.TagHelpers +{ + public class TagHelperAttributeNode + { + public TagHelperAttributeNode(string name, SyntaxTreeNode value, HtmlAttributeValueStyle valueStyle) + { + Name = name; + Value = value; + ValueStyle = valueStyle; + } + + // Internal for testing + internal TagHelperAttributeNode(string name, SyntaxTreeNode value) + : this(name, value, HtmlAttributeValueStyle.DoubleQuotes) + { + } + + public string Name { get; } + + public SyntaxTreeNode Value { get; } + + public HtmlAttributeValueStyle ValueStyle { get; } + } +} diff --git a/src/Microsoft.AspNetCore.Razor/Parser/TagHelpers/TagHelperBlock.cs b/src/Microsoft.AspNetCore.Razor/Parser/TagHelpers/TagHelperBlock.cs index bb81f252c..b43a2fd32 100644 --- a/src/Microsoft.AspNetCore.Razor/Parser/TagHelpers/TagHelperBlock.cs +++ b/src/Microsoft.AspNetCore.Razor/Parser/TagHelpers/TagHelperBlock.cs @@ -29,7 +29,7 @@ public TagHelperBlock(TagHelperBlockBuilder source) { TagName = source.TagName; Descriptors = source.Descriptors; - Attributes = new List>(source.Attributes); + Attributes = new List(source.Attributes); _start = source.Start; TagMode = source.TagMode; SourceStartTag = source.SourceStartTag; @@ -71,7 +71,7 @@ public TagHelperBlock(TagHelperBlockBuilder source) /// /// The HTML attributes. /// - public IList> Attributes { get; } + public IList Attributes { get; } /// public override SourceLocation Start diff --git a/src/Microsoft.AspNetCore.Razor/Parser/TagHelpers/TagHelperBlockBuilder.cs b/src/Microsoft.AspNetCore.Razor/Parser/TagHelpers/TagHelperBlockBuilder.cs index 6d71b3011..3063c315a 100644 --- a/src/Microsoft.AspNetCore.Razor/Parser/TagHelpers/TagHelperBlockBuilder.cs +++ b/src/Microsoft.AspNetCore.Razor/Parser/TagHelpers/TagHelperBlockBuilder.cs @@ -24,7 +24,7 @@ public TagHelperBlockBuilder(TagHelperBlock original) { TagName = original.TagName; Descriptors = original.Descriptors; - Attributes = new List>(original.Attributes); + Attributes = new List(original.Attributes); } /// @@ -41,14 +41,14 @@ public TagHelperBlockBuilder( string tagName, TagMode tagMode, SourceLocation start, - IList> attributes, + IList attributes, IEnumerable descriptors) { TagName = tagName; TagMode = tagMode; Start = start; Descriptors = descriptors; - Attributes = new List>(attributes); + Attributes = new List(attributes); Type = BlockType.Tag; ChunkGenerator = new TagHelperChunkGenerator(descriptors); } @@ -57,7 +57,7 @@ public TagHelperBlockBuilder( internal TagHelperBlockBuilder( string tagName, TagMode tagMode, - IList> attributes, + IList attributes, IEnumerable children) { TagName = tagName; @@ -98,7 +98,7 @@ internal TagHelperBlockBuilder( /// /// The HTML attributes. /// - public IList> Attributes { get; } + public IList Attributes { get; } /// /// The HTML tag name. diff --git a/src/Microsoft.AspNetCore.Razor/Parser/TagHelpers/TagHelperBlockRewriter.cs b/src/Microsoft.AspNetCore.Razor/Parser/TagHelpers/TagHelperBlockRewriter.cs index 1659736df..8fefd92e5 100644 --- a/src/Microsoft.AspNetCore.Razor/Parser/TagHelpers/TagHelperBlockRewriter.cs +++ b/src/Microsoft.AspNetCore.Razor/Parser/TagHelpers/TagHelperBlockRewriter.cs @@ -32,7 +32,7 @@ public static TagHelperBlockBuilder Rewrite( return new TagHelperBlockBuilder(tagName, tagMode, start, attributes, descriptors); } - private static IList> GetTagAttributes( + private static IList GetTagAttributes( string tagName, bool validStructure, Block tagBlock, @@ -43,7 +43,7 @@ private static IList> GetTagAttributes( // contained TagHelperAttributeDescriptor's. descriptors = descriptors.Distinct(TypeBasedTagHelperDescriptorComparer.Default); - var attributes = new List>(); + var attributes = new List(); // We skip the first child "" or "/>". // The -2 accounts for both the start and end tags. If the tag does not have a valid structure then there's @@ -102,8 +102,12 @@ private static IList> GetTagAttributes( result.AttributeName.Length); } - attributes.Add( - new KeyValuePair(result.AttributeName, result.AttributeValueNode)); + var attributeNode = new TagHelperAttributeNode( + result.AttributeName, + result.AttributeValueNode, + result.AttributeValueStyle); + + attributes.Add(attributeNode); } else { @@ -161,6 +165,10 @@ private static TryParseResult TryParseSpan( var capturedAttributeValueStart = false; var attributeValueStartLocation = span.Start; + // Default to DoubleQuotes. We purposefully do not persist NoQuotes ValueStyle to stay consistent with the + // TryParseBlock() variation of attribute parsing. + var attributeValueStyle = HtmlAttributeValueStyle.DoubleQuotes; + // The symbolOffset is initialized to 0 to expect worst case: "class=". If a quote is found later on for // the attribute value the symbolOffset is adjusted accordingly. var symbolOffset = 0; @@ -229,6 +237,11 @@ private static TryParseResult TryParseSpan( // Check for attribute start values, aka single or double quote if (i < htmlSymbols.Length && IsQuote(htmlSymbols[i])) { + if (htmlSymbols[i].Type == HtmlSymbolType.SingleQuote) + { + attributeValueStyle = HtmlAttributeValueStyle.SingleQuotes; + } + symbolStartLocation = htmlSymbols[i].Start; // If there's a start quote then there must be an end quote to be valid, skip it. @@ -290,8 +303,13 @@ private static TryParseResult TryParseSpan( { attributeValue = CreateMarkupAttribute(builder, result.IsBoundNonStringAttribute); } + else + { + attributeValueStyle = HtmlAttributeValueStyle.Minimized; + } result.AttributeValueNode = attributeValue; + result.AttributeValueStyle = attributeValueStyle; return result; } @@ -347,6 +365,30 @@ private static TryParseResult TryParseBlock( // Have a name now. Able to determine correct isBoundNonStringAttribute value. var result = CreateTryParseResult(name, descriptors); + var firstChild = builder.Children[0] as Span; + if (firstChild != null && firstChild.Symbols[0] is HtmlSymbol) + { + var htmlSymbol = firstChild.Symbols[firstChild.Symbols.Count - 1] as HtmlSymbol; + switch (htmlSymbol.Type) + { + // Treat NoQuotes and DoubleQuotes equivalently. We purposefully do not persist NoQuotes + // ValueStyles at code generation time to protect users from rendering dynamic content with spaces + // that can break attributes. + // Ex: where @value results in the test "hello world". + // This way, the above code would render . + case HtmlSymbolType.Equals: + case HtmlSymbolType.DoubleQuote: + result.AttributeValueStyle = HtmlAttributeValueStyle.DoubleQuotes; + break; + case HtmlSymbolType.SingleQuote: + result.AttributeValueStyle = HtmlAttributeValueStyle.SingleQuotes; + break; + default: + result.AttributeValueStyle = HtmlAttributeValueStyle.Minimized; + break; + } + } + // Remove first child i.e. foo=" builder.Children.RemoveAt(0); @@ -664,6 +706,8 @@ private class TryParseResult public SyntaxTreeNode AttributeValueNode { get; set; } + public HtmlAttributeValueStyle AttributeValueStyle { get; set; } + public bool IsBoundAttribute { get; set; } public bool IsBoundNonStringAttribute { get; set; } diff --git a/src/Microsoft.AspNetCore.Razor/TagHelpers/HtmlAttributeValueStyle.cs b/src/Microsoft.AspNetCore.Razor/TagHelpers/HtmlAttributeValueStyle.cs new file mode 100644 index 000000000..7ac198567 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor/TagHelpers/HtmlAttributeValueStyle.cs @@ -0,0 +1,13 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +namespace Microsoft.AspNetCore.Razor.TagHelpers +{ + public enum HtmlAttributeValueStyle + { + DoubleQuotes, + SingleQuotes, + NoQuotes, + Minimized, + } +} diff --git a/test/Microsoft.AspNetCore.Razor.Runtime.Test/Runtime/TagHelpers/CaseSensitiveTagHelperAttributeComparer.cs b/test/Microsoft.AspNetCore.Razor.Runtime.Test/Runtime/TagHelpers/CaseSensitiveTagHelperAttributeComparer.cs index 9943d38e5..926252ff3 100644 --- a/test/Microsoft.AspNetCore.Razor.Runtime.Test/Runtime/TagHelpers/CaseSensitiveTagHelperAttributeComparer.cs +++ b/test/Microsoft.AspNetCore.Razor.Runtime.Test/Runtime/TagHelpers/CaseSensitiveTagHelperAttributeComparer.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using Microsoft.Extensions.Internal; namespace Microsoft.AspNetCore.Razor.TagHelpers { @@ -25,13 +26,17 @@ public bool Equals(TagHelperAttribute attributeX, TagHelperAttribute attributeY) // Normal comparer (TagHelperAttribute.Equals()) doesn't care about the Name case, in tests we do. return attributeX != null && string.Equals(attributeX.Name, attributeY.Name, StringComparison.Ordinal) && - attributeX.Minimized == attributeY.Minimized && - (attributeX.Minimized || Equals(attributeX.Value, attributeY.Value)); + attributeX.ValueStyle == attributeY.ValueStyle && + (attributeX.ValueStyle == HtmlAttributeValueStyle.Minimized || Equals(attributeX.Value, attributeY.Value)); } public int GetHashCode(TagHelperAttribute attribute) { - return attribute.GetHashCode(); + var combiner = HashCodeCombiner.Start(); + combiner.Add(attribute.Name, StringComparer.Ordinal); + combiner.Add(attribute.GetHashCode()); + + return combiner.CombinedHash; } } } \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Razor.Runtime.Test/Runtime/TagHelpers/TagHelperExecutionContextTest.cs b/test/Microsoft.AspNetCore.Razor.Runtime.Test/Runtime/TagHelpers/TagHelperExecutionContextTest.cs index d246b3556..a06f7c28b 100644 --- a/test/Microsoft.AspNetCore.Razor.Runtime.Test/Runtime/TagHelpers/TagHelperExecutionContextTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Runtime.Test/Runtime/TagHelpers/TagHelperExecutionContextTest.cs @@ -71,7 +71,7 @@ public async Task ExecutionContext_Reinitialize_UpdatesTagHelperOutputAsExpected updatedCallCount++; return Task.FromResult(true); }; - executionContext.AddMinimizedHtmlAttribute("something"); + executionContext.AddHtmlAttribute(new TagHelperAttribute("something")); // Act - 1 executionContext.Reinitialize( @@ -80,7 +80,7 @@ public async Task ExecutionContext_Reinitialize_UpdatesTagHelperOutputAsExpected items: new Dictionary(), uniqueId: string.Empty, executeChildContentAsync: updatedExecuteChildContentAsync); - executionContext.AddMinimizedHtmlAttribute("Another attribute"); + executionContext.AddHtmlAttribute(new TagHelperAttribute("Another attribute")); // Assert - 1 var output = executionContext.Output; @@ -123,7 +123,7 @@ public void ExecutionContext_Reinitialize_UpdatesTagHelperContextAsExpected() endWritingScope); var updatedItems = new Dictionary(); var updatedUniqueId = "another unique id"; - executionContext.AddMinimizedHtmlAttribute("something"); + executionContext.AddHtmlAttribute(new TagHelperAttribute("something")); // Act executionContext.Reinitialize( @@ -132,7 +132,7 @@ public void ExecutionContext_Reinitialize_UpdatesTagHelperContextAsExpected() updatedItems, updatedUniqueId, executeChildContentAsync); - executionContext.AddMinimizedHtmlAttribute("Another attribute"); + executionContext.AddHtmlAttribute(new TagHelperAttribute("Another attribute")); // Assert var context = executionContext.Context; @@ -409,12 +409,12 @@ public void AddHtmlAttribute_MaintainsHtmlAttributes() var expectedAttributes = new TagHelperAttributeList { { "class", "btn" }, - { "foo", "bar" } }; + expectedAttributes.Add(new TagHelperAttribute("type", "text", HtmlAttributeValueStyle.SingleQuotes)); // Act - executionContext.AddHtmlAttribute("class", "btn"); - executionContext.AddHtmlAttribute("foo", "bar"); + executionContext.AddHtmlAttribute("class", "btn", HtmlAttributeValueStyle.DoubleQuotes); + executionContext.AddHtmlAttribute("type", "text", HtmlAttributeValueStyle.SingleQuotes); var output = executionContext.Output; // Assert @@ -425,7 +425,7 @@ public void AddHtmlAttribute_MaintainsHtmlAttributes() } [Fact] - public void AddMinimizedHtmlAttribute_MaintainsHtmlAttributes() + public void AddHtmlAttribute_MaintainsMinimizedHtmlAttributes() { // Arrange var executionContext = new TagHelperExecutionContext("input", tagMode: TagMode.StartTagOnly); @@ -436,8 +436,8 @@ public void AddMinimizedHtmlAttribute_MaintainsHtmlAttributes() }; // Act - executionContext.AddMinimizedHtmlAttribute("checked"); - executionContext.AddMinimizedHtmlAttribute("visible"); + executionContext.AddHtmlAttribute(new TagHelperAttribute("checked")); + executionContext.AddHtmlAttribute(new TagHelperAttribute("visible")); var output = executionContext.Output; // Assert @@ -448,7 +448,7 @@ public void AddMinimizedHtmlAttribute_MaintainsHtmlAttributes() } [Fact] - public void AddMinimizedHtmlAttribute_MaintainsHtmlAttributes_SomeMinimized() + public void AddHtmlAttribute_MaintainsHtmlAttributes_VariousStyles() { // Arrange var executionContext = new TagHelperExecutionContext("input", tagMode: TagMode.SelfClosing); @@ -457,14 +457,18 @@ public void AddMinimizedHtmlAttribute_MaintainsHtmlAttributes_SomeMinimized() { "class", "btn" }, { "foo", "bar" } }; + expectedAttributes.Add(new TagHelperAttribute("valid", "true", HtmlAttributeValueStyle.NoQuotes)); + expectedAttributes.Add(new TagHelperAttribute("type", "text", HtmlAttributeValueStyle.SingleQuotes)); expectedAttributes.Add(new TagHelperAttribute(name: "checked")); expectedAttributes.Add(new TagHelperAttribute(name: "visible")); // Act - executionContext.AddHtmlAttribute("class", "btn"); - executionContext.AddHtmlAttribute("foo", "bar"); - executionContext.AddMinimizedHtmlAttribute("checked"); - executionContext.AddMinimizedHtmlAttribute("visible"); + executionContext.AddHtmlAttribute("class", "btn", HtmlAttributeValueStyle.DoubleQuotes); + executionContext.AddHtmlAttribute("foo", "bar", HtmlAttributeValueStyle.DoubleQuotes); + executionContext.AddHtmlAttribute("valid", "true", HtmlAttributeValueStyle.NoQuotes); + executionContext.AddHtmlAttribute("type", "text", HtmlAttributeValueStyle.SingleQuotes); + executionContext.AddHtmlAttribute(new TagHelperAttribute("checked")); + executionContext.AddHtmlAttribute(new TagHelperAttribute("visible")); var output = executionContext.Output; // Assert @@ -482,14 +486,14 @@ public void TagHelperExecutionContext_MaintainsAllAttributes() var expectedAttributes = new TagHelperAttributeList { { "class", "btn" }, - { "something", true }, - { "foo", "bar" } }; + expectedAttributes.Add(new TagHelperAttribute("something", true, HtmlAttributeValueStyle.SingleQuotes)); + expectedAttributes.Add(new TagHelperAttribute("type", "text", HtmlAttributeValueStyle.NoQuotes)); // Act - executionContext.AddHtmlAttribute("class", "btn"); - executionContext.AddTagHelperAttribute("something", true); - executionContext.AddHtmlAttribute("foo", "bar"); + executionContext.AddHtmlAttribute("class", "btn", HtmlAttributeValueStyle.DoubleQuotes); + executionContext.AddTagHelperAttribute("something", true, HtmlAttributeValueStyle.SingleQuotes); + executionContext.AddHtmlAttribute("type", "text", HtmlAttributeValueStyle.NoQuotes); var context = executionContext.Context; // Assert diff --git a/test/Microsoft.AspNetCore.Razor.Runtime.Test/Runtime/TagHelpers/TagHelperRunnerTest.cs b/test/Microsoft.AspNetCore.Razor.Runtime.Test/Runtime/TagHelpers/TagHelperRunnerTest.cs index d318d8889..af59c20de 100644 --- a/test/Microsoft.AspNetCore.Razor.Runtime.Test/Runtime/TagHelpers/TagHelperRunnerTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Runtime.Test/Runtime/TagHelpers/TagHelperRunnerTest.cs @@ -124,7 +124,7 @@ public async Task RunAsync_SetsTagHelperOutputTagMode(TagMode tagMode) var tagHelper = new TagHelperContextTouchingTagHelper(); executionContext.Add(tagHelper); - executionContext.AddTagHelperAttribute("foo", true); + executionContext.AddTagHelperAttribute("foo", true, HtmlAttributeValueStyle.DoubleQuotes); // Act await runner.RunAsync(executionContext); @@ -162,7 +162,7 @@ public async Task RunAsync_AllowsModificationOfTagHelperOutput() // Act executionContext.Add(executableTagHelper); - executionContext.AddHtmlAttribute("class", "btn"); + executionContext.AddHtmlAttribute("class", "btn", HtmlAttributeValueStyle.DoubleQuotes); await runner.RunAsync(executionContext); // Assert @@ -183,7 +183,7 @@ public async Task RunAsync_AllowsDataRetrievalFromTagHelperContext() // Act executionContext.Add(tagHelper); - executionContext.AddTagHelperAttribute("foo", true); + executionContext.AddTagHelperAttribute("foo", true, HtmlAttributeValueStyle.DoubleQuotes); await runner.RunAsync(executionContext); // Assert diff --git a/test/Microsoft.AspNetCore.Razor.Runtime.Test/TagHelpers/TagHelperOutputTest.cs b/test/Microsoft.AspNetCore.Razor.Runtime.Test/TagHelpers/TagHelperOutputTest.cs index 04c947137..e114fb7f1 100644 --- a/test/Microsoft.AspNetCore.Razor.Runtime.Test/TagHelpers/TagHelperOutputTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Runtime.Test/TagHelpers/TagHelperOutputTest.cs @@ -478,6 +478,22 @@ public static TheoryData WriteTagHelper_InputData postElement: null), "

Hello World!

" }, + { + GetTagHelperOutput( + tagName: "p", + attributes: new TagHelperAttributeList() + { + { new TagHelperAttribute("test", "testVal", HtmlAttributeValueStyle.NoQuotes) }, + { new TagHelperAttribute("something", " spaced ", HtmlAttributeValueStyle.SingleQuotes) }, + }, + tagMode: TagMode.StartTagAndEndTag, + preElement: null, + preContent: null, + content: "Hello World!", + postContent: null, + postElement: null), + "

Hello World!

" + }, { GetTagHelperOutput( tagName: "p", @@ -531,7 +547,7 @@ public static TheoryData WriteTagHelper_InputData attributes: new TagHelperAttributeList() { new TagHelperAttribute("test"), - new TagHelperAttribute("last", "unminimized"), + new TagHelperAttribute("last", "unminimized", HtmlAttributeValueStyle.NoQuotes), }, tagMode: TagMode.StartTagAndEndTag, preElement: null, @@ -539,7 +555,7 @@ public static TheoryData WriteTagHelper_InputData content: "Hello World!", postContent: null, postElement: null), - "

Hello World!

" + "

Hello World!

" }, { GetTagHelperOutput( @@ -572,14 +588,17 @@ public static TheoryData WriteTagHelper_InputData { GetTagHelperOutput( tagName: "p", - attributes: new TagHelperAttributeList() { { "test", "testVal" } }, + attributes: new TagHelperAttributeList() + { + { new TagHelperAttribute("test", "testVal", HtmlAttributeValueStyle.SingleQuotes) } + }, tagMode: TagMode.StartTagOnly, preElement: null, preContent: null, content: "Hello World!", postContent: null, postElement: null), - "

" + "

" }, { GetTagHelperOutput( @@ -777,6 +796,21 @@ public static TheoryData WriteTagHelper_InputData postElement: null), "Before" }, + { + GetTagHelperOutput( + tagName: string.Empty, + attributes: new TagHelperAttributeList + { + { new TagHelperAttribute("test", "testVal", HtmlAttributeValueStyle.SingleQuotes) } + }, + tagMode: TagMode.StartTagOnly, + preElement: "Before", + preContent: null, + content: null, + postContent: null, + postElement: null), + "Before" + }, { GetTagHelperOutput( tagName: "custom", diff --git a/test/Microsoft.AspNetCore.Razor.Test/CodeGenerators/CSharpTagHelperRenderingTest.cs b/test/Microsoft.AspNetCore.Razor.Test/CodeGenerators/CSharpTagHelperRenderingTest.cs index 01a18aa0e..064719201 100644 --- a/test/Microsoft.AspNetCore.Razor.Test/CodeGenerators/CSharpTagHelperRenderingTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Test/CodeGenerators/CSharpTagHelperRenderingTest.cs @@ -1307,12 +1307,20 @@ public static TheoryData DesignTimeTagHelperTestData generatedLineIndex: 36, generatedCharacterOffsetIndex: 42, contentLength: 4), + BuildLineMapping( + documentAbsoluteIndex: 220, + documentLineIndex: 5, + documentCharacterOffsetIndex: 34, + generatedAbsoluteIndex: 2234, + generatedLineIndex: 45, + generatedCharacterOffsetIndex: 42, + contentLength: 4), BuildLineMapping( documentAbsoluteIndex: 41, documentLineIndex: 2, documentCharacterOffsetIndex: 8, - generatedAbsoluteIndex: 1962, - generatedLineIndex: 42, + generatedAbsoluteIndex: 2447, + generatedLineIndex: 51, generatedCharacterOffsetIndex: 33, contentLength: 1), } diff --git a/test/Microsoft.AspNetCore.Razor.Test/CodeGenerators/CSharpTagHelperRenderingUnitTest.cs b/test/Microsoft.AspNetCore.Razor.Test/CodeGenerators/CSharpTagHelperRenderingUnitTest.cs index 63b088fdc..e69b43568 100644 --- a/test/Microsoft.AspNetCore.Razor.Test/CodeGenerators/CSharpTagHelperRenderingUnitTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Test/CodeGenerators/CSharpTagHelperRenderingUnitTest.cs @@ -241,14 +241,14 @@ private static TagHelperChunk CreateTagHelperChunk(string tagName, IEnumerable>(), + attributes: new List(), descriptors: tagHelperDescriptors) { Association = new TagHelperBlock( new TagHelperBlockBuilder( tagName, tagMode: TagMode.StartTagAndEndTag, - attributes: new List>(), + attributes: new List(), children: Enumerable.Empty())), Children = new List(), }; diff --git a/test/Microsoft.AspNetCore.Razor.Test/Framework/BlockFactory.cs b/test/Microsoft.AspNetCore.Razor.Test/Framework/BlockFactory.cs index fa702bd05..8d65d4dbf 100644 --- a/test/Microsoft.AspNetCore.Razor.Test/Framework/BlockFactory.cs +++ b/test/Microsoft.AspNetCore.Razor.Test/Framework/BlockFactory.cs @@ -69,7 +69,7 @@ public Block TagHelperBlock( var builder = new TagHelperBlockBuilder( tagName, tagMode, - attributes: new List>(), + attributes: new List(), children: children) { Start = start, diff --git a/test/Microsoft.AspNetCore.Razor.Test/Framework/BlockTypes.cs b/test/Microsoft.AspNetCore.Razor.Test/Framework/BlockTypes.cs index 62bfbaa7a..c64aeffd5 100644 --- a/test/Microsoft.AspNetCore.Razor.Test/Framework/BlockTypes.cs +++ b/test/Microsoft.AspNetCore.Razor.Test/Framework/BlockTypes.cs @@ -132,18 +132,18 @@ public MarkupBlock(params SyntaxTreeNode[] children) public class MarkupTagHelperBlock : TagHelperBlock { public MarkupTagHelperBlock(string tagName) - : this(tagName, tagMode: TagMode.StartTagAndEndTag, attributes: new List>()) + : this(tagName, tagMode: TagMode.StartTagAndEndTag, attributes: new List()) { } public MarkupTagHelperBlock(string tagName, TagMode tagMode) - : this(tagName, tagMode, new List>()) + : this(tagName, tagMode, new List()) { } public MarkupTagHelperBlock( string tagName, - IList> attributes) + IList attributes) : this(tagName, TagMode.StartTagAndEndTag, attributes, children: new SyntaxTreeNode[0]) { } @@ -151,7 +151,7 @@ public MarkupTagHelperBlock( public MarkupTagHelperBlock( string tagName, TagMode tagMode, - IList> attributes) + IList attributes) : this(tagName, tagMode, attributes, new SyntaxTreeNode[0]) { } @@ -160,19 +160,19 @@ public MarkupTagHelperBlock(string tagName, params SyntaxTreeNode[] children) : this( tagName, TagMode.StartTagAndEndTag, - attributes: new List>(), + attributes: new List(), children: children) { } public MarkupTagHelperBlock(string tagName, TagMode tagMode, params SyntaxTreeNode[] children) - : this(tagName, tagMode, new List>(), children) + : this(tagName, tagMode, new List(), children) { } public MarkupTagHelperBlock( string tagName, - IList> attributes, + IList attributes, params SyntaxTreeNode[] children) : base(new TagHelperBlockBuilder( tagName, @@ -185,7 +185,7 @@ public MarkupTagHelperBlock( public MarkupTagHelperBlock( string tagName, TagMode tagMode, - IList> attributes, + IList attributes, params SyntaxTreeNode[] children) : base(new TagHelperBlockBuilder(tagName, tagMode, attributes, children)) { diff --git a/test/Microsoft.AspNetCore.Razor.Test/Framework/ParserTestBase.cs b/test/Microsoft.AspNetCore.Razor.Test/Framework/ParserTestBase.cs index 8c05f4381..eb83a9926 100644 --- a/test/Microsoft.AspNetCore.Razor.Test/Framework/ParserTestBase.cs +++ b/test/Microsoft.AspNetCore.Razor.Test/Framework/ParserTestBase.cs @@ -324,24 +324,30 @@ private static void EvaluateSyntaxTreeNode(ErrorCollector collector, SyntaxTreeN } } - private static void EvaluateTagHelperAttribute(ErrorCollector collector, - KeyValuePair actual, - KeyValuePair expected) + private static void EvaluateTagHelperAttribute( + ErrorCollector collector, + TagHelperAttributeNode actual, + TagHelperAttributeNode expected) { - if (actual.Key != expected.Key) + if (actual.Name != expected.Name) { - collector.AddError("{0} - FAILED :: Attribute names do not match", expected.Key); + collector.AddError("{0} - FAILED :: Attribute names do not match", expected.Name); } else { - collector.AddMessage("{0} - PASSED :: Attribute names match", expected.Key); + collector.AddMessage("{0} - PASSED :: Attribute names match", expected.Name); } - if (actual.Value == null && expected.Value == null) + if (actual.ValueStyle != expected.ValueStyle) { - collector.AddMessage("{0} - PASSED :: Minimized attribute values match", expected.Key); + collector.AddError("{0} - FAILED :: Attribute value styles do not match", expected.ValueStyle.ToString()); } else + { + collector.AddMessage("{0} - PASSED :: Attribute value style match", expected.ValueStyle); + } + + if (actual.ValueStyle != HtmlAttributeValueStyle.Minimized) { EvaluateSyntaxTreeNode(collector, actual.Value, expected.Value); } @@ -435,7 +441,7 @@ private static void EvaluateTagHelperBlock(ErrorCollector collector, TagHelperBl } while (actualAttributes.MoveNext()) { - collector.AddError("End of Attributes - FAILED :: Found Attribute: {0}", actualAttributes.Current.Key); + collector.AddError("End of Attributes - FAILED :: Found Attribute: {0}", actualAttributes.Current.Name); } } } diff --git a/test/Microsoft.AspNetCore.Razor.Test/TagHelpers/TagHelperBlockRewriterTest.cs b/test/Microsoft.AspNetCore.Razor.Test/TagHelpers/TagHelperBlockRewriterTest.cs index e3359b911..9a159fe25 100644 --- a/test/Microsoft.AspNetCore.Razor.Test/TagHelpers/TagHelperBlockRewriterTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Test/TagHelpers/TagHelperBlockRewriterTest.cs @@ -8,6 +8,7 @@ using Microsoft.AspNetCore.Razor.Chunks.Generators; using Microsoft.AspNetCore.Razor.Parser; using Microsoft.AspNetCore.Razor.Parser.SyntaxTree; +using Microsoft.AspNetCore.Razor.Parser.TagHelpers; using Microsoft.AspNetCore.Razor.TagHelpers; using Microsoft.AspNetCore.Razor.Test.Framework; using Microsoft.AspNetCore.Razor.Test.TagHelpers; @@ -30,32 +31,33 @@ public static TheoryData SymbolBoundAttributeData "

    ", new MarkupBlock( new MarkupTagHelperBlock("ul", - attributes: new List> + attributes: new List { - new KeyValuePair("bound", null), - new KeyValuePair("[item]", factory.CodeMarkup("items")) + new TagHelperAttributeNode("bound", null, HtmlAttributeValueStyle.Minimized), + new TagHelperAttributeNode("[item]", factory.CodeMarkup("items"), HtmlAttributeValueStyle.SingleQuotes) })) }, { "
      ", new MarkupBlock( new MarkupTagHelperBlock("ul", - attributes: new List> + attributes: new List { - new KeyValuePair("bound", null), - new KeyValuePair("[(item)]", factory.CodeMarkup("items")) + new TagHelperAttributeNode("bound", null, HtmlAttributeValueStyle.Minimized), + new TagHelperAttributeNode("[(item)]", factory.CodeMarkup("items"), HtmlAttributeValueStyle.SingleQuotes) })) }, { "", new MarkupBlock( new MarkupTagHelperBlock("button", - attributes: new List> + attributes: new List { - new KeyValuePair("bound", null), - new KeyValuePair( + new TagHelperAttributeNode("bound", null, HtmlAttributeValueStyle.Minimized), + new TagHelperAttributeNode( "(click)", - factory.CodeMarkup("doSomething()")) + factory.CodeMarkup("doSomething()"), + HtmlAttributeValueStyle.SingleQuotes) }, children: factory.Markup("Click Me"))) }, @@ -63,12 +65,13 @@ public static TheoryData SymbolBoundAttributeData "", new MarkupBlock( new MarkupTagHelperBlock("button", - attributes: new List> + attributes: new List { - new KeyValuePair("bound", null), - new KeyValuePair( + new TagHelperAttributeNode("bound", null, HtmlAttributeValueStyle.Minimized), + new TagHelperAttributeNode( "(^click)", - factory.CodeMarkup("doSomething()")) + factory.CodeMarkup("doSomething()"), + HtmlAttributeValueStyle.SingleQuotes) }, children: factory.Markup("Click Me"))) }, @@ -76,30 +79,33 @@ public static TheoryData SymbolBoundAttributeData "", new MarkupBlock( new MarkupTagHelperBlock("template", - attributes: new List> + attributes: new List { - new KeyValuePair("bound", null), - new KeyValuePair("*something", factory.Markup("value")) + new TagHelperAttributeNode("bound", null, HtmlAttributeValueStyle.Minimized), + new TagHelperAttributeNode( + "*something", + factory.Markup("value"), + HtmlAttributeValueStyle.SingleQuotes) })) }, { "
      ", new MarkupBlock( new MarkupTagHelperBlock("div", - attributes: new List> + attributes: new List { - new KeyValuePair("bound", null), - new KeyValuePair("#localminimized", null) + new TagHelperAttributeNode("bound", null, HtmlAttributeValueStyle.Minimized), + new TagHelperAttributeNode("#localminimized", null, HtmlAttributeValueStyle.Minimized) })) }, { "
      ", new MarkupBlock( new MarkupTagHelperBlock("div", - attributes: new List> + attributes: new List { - new KeyValuePair("bound", null), - new KeyValuePair("#local", factory.Markup("value")) + new TagHelperAttributeNode("bound", null, HtmlAttributeValueStyle.Minimized), + new TagHelperAttributeNode("#local", factory.Markup("value"), HtmlAttributeValueStyle.SingleQuotes) })) }, }; @@ -186,9 +192,9 @@ public static TheoryData WithoutEndTagElementData new MarkupTagHelperBlock( "input", TagMode.StartTagOnly, - attributes: new List> + attributes: new List { - new KeyValuePair("type", factory.Markup("text")) + new TagHelperAttributeNode("type", factory.Markup("text"), HtmlAttributeValueStyle.SingleQuotes) })) }, { @@ -203,9 +209,9 @@ public static TheoryData WithoutEndTagElementData new MarkupTagHelperBlock( "input", TagMode.StartTagOnly, - attributes: new List> + attributes: new List { - new KeyValuePair("type", factory.Markup("text")) + new TagHelperAttributeNode("type", factory.Markup("text"), HtmlAttributeValueStyle.SingleQuotes) }), new MarkupTagHelperBlock("input", TagMode.StartTagOnly)) }, @@ -272,9 +278,9 @@ public static TheoryData TagStructureCompatibilityData new MarkupTagHelperBlock( "input", TagMode.StartTagOnly, - attributes: new List> + attributes: new List { - new KeyValuePair("type", factory.Markup("text")) + new TagHelperAttributeNode("type", factory.Markup("text"), HtmlAttributeValueStyle.SingleQuotes) })) }, { @@ -293,9 +299,9 @@ public static TheoryData TagStructureCompatibilityData new MarkupTagHelperBlock( "input", TagMode.StartTagAndEndTag, - attributes: new List> + attributes: new List { - new KeyValuePair("type", factory.Markup("text")) + new TagHelperAttributeNode("type", factory.Markup("text"), HtmlAttributeValueStyle.SingleQuotes) })) }, { @@ -380,11 +386,12 @@ public static TheoryData MalformedTagHelperAt "

      ", new MarkupBlock( new MarkupTagHelperBlock("p", - new List> + new List { - new KeyValuePair( + new TagHelperAttributeNode( "bar", - new MarkupBlock(factory.Markup("false"), factory.Markup(" "))) + new MarkupBlock(factory.Markup("false"), factory.Markup(" ")), + HtmlAttributeValueStyle.SingleQuotes) })), new [] { @@ -440,13 +448,14 @@ public static TheoryData MalformedTagHelperAt "

      > + new List { - new KeyValuePair( + new TagHelperAttributeNode( "bar", new MarkupBlock( factory.Markup("false"), - factory.Markup(" MalformedTagHelperAt "

      > + new List { - new KeyValuePair( + new TagHelperAttributeNode( "bar", - factory.Markup("false")) + factory.Markup("false"), + HtmlAttributeValueStyle.DoubleQuotes) })), new [] { @@ -490,9 +500,9 @@ public static TheoryData MalformedTagHelperAt "

      > + new List { - new KeyValuePair( + new TagHelperAttributeNode( "bar", factory.Markup("false'")) })), @@ -512,9 +522,9 @@ public static TheoryData MalformedTagHelperAt "

      ", new MarkupBlock( new MarkupTagHelperBlock("p", - new List> + new List { - new KeyValuePair( + new TagHelperAttributeNode( "bar", new MarkupBlock( factory.Markup("false'"), @@ -536,10 +546,10 @@ public static TheoryData MalformedTagHelperAt "

      ", new MarkupBlock( new MarkupTagHelperBlock("p", - new List> + new List { - new KeyValuePair("foo", null), - new KeyValuePair("bar", null) + new TagHelperAttributeNode("foo", null, HtmlAttributeValueStyle.Minimized), + new TagHelperAttributeNode("bar", null, HtmlAttributeValueStyle.Minimized) }, new MarkupTagHelperBlock("strong"))), new [] @@ -562,9 +572,9 @@ public static TheoryData MalformedTagHelperAt "

      ", new MarkupBlock( new MarkupTagHelperBlock("p", - new List> + new List { - new KeyValuePair("class", factory.Markup("btn")) + new TagHelperAttributeNode("class", factory.Markup("btn")) })), new [] { @@ -578,9 +588,9 @@ public static TheoryData MalformedTagHelperAt "

      ", new MarkupBlock( new MarkupTagHelperBlock("p", - new List> + new List { - new KeyValuePair("class", factory.Markup("btn")) + new TagHelperAttributeNode("class", factory.Markup("btn")) })), new [] { @@ -594,12 +604,12 @@ public static TheoryData MalformedTagHelperAt "

      ", new MarkupBlock( new MarkupTagHelperBlock("p", - new List> + new List { - new KeyValuePair( + new TagHelperAttributeNode( "class", new MarkupBlock(factory.Markup("btn"), factory.Markup(" bar="))), - new KeyValuePair("foo", null) + new TagHelperAttributeNode("foo", null, HtmlAttributeValueStyle.Minimized) }, new MarkupTagHelperBlock("strong"))), new [] @@ -622,12 +632,12 @@ public static TheoryData MalformedTagHelperAt "

      ", new MarkupBlock( new MarkupTagHelperBlock("p", - new List> + new List { - new KeyValuePair( + new TagHelperAttributeNode( "class", new MarkupBlock(factory.Markup("btn"), factory.Markup(" bar="))), - new KeyValuePair("foo", null), + new TagHelperAttributeNode("foo", null, HtmlAttributeValueStyle.Minimized), })), new RazorError[0] }, @@ -657,9 +667,9 @@ public static TheoryData MalformedTagHelperAt "

      ", new MarkupBlock( new MarkupTagHelperBlock("p", - new List> + new List { - new KeyValuePair( + new TagHelperAttributeNode( "class", new MarkupBlock( new MarkupBlock( @@ -672,7 +682,8 @@ public static TheoryData MalformedTagHelperAt factory.CodeTransition(), factory.Code("DateTime.Now") .AsImplicitExpression(CSharpCodeParser.DefaultKeywords) - .Accepts(AcceptedCharacters.NonWhiteSpace))))) + .Accepts(AcceptedCharacters.NonWhiteSpace)))), + HtmlAttributeValueStyle.DoubleQuotes) })), new [] { @@ -686,9 +697,9 @@ public static TheoryData MalformedTagHelperAt "

      > + new List { - new KeyValuePair( + new TagHelperAttributeNode( "class", createInvalidDoBlock(string.Empty)) })), @@ -711,9 +722,9 @@ public static TheoryData MalformedTagHelperAt "

      ", new MarkupBlock( new MarkupTagHelperBlock("p", - new List> + new List { - new KeyValuePair("class", createInvalidDoBlock("\">

      ")) + new TagHelperAttributeNode("class", createInvalidDoBlock("\">

      ")) })), new [] { @@ -762,9 +773,9 @@ public static TheoryData MalformedTagHelperAt "

      ", new MarkupBlock( new MarkupTagHelperBlock("p", - new List> + new List { - new KeyValuePair("class", factory.Markup("some")) + new TagHelperAttributeNode("class", factory.Markup("some")) })), new [] { @@ -972,9 +983,9 @@ public static TheoryData CodeTagHelperAttributesData new MarkupBlock( new MarkupTagHelperBlock("person", TagMode.SelfClosing, - attributes: new List> + attributes: new List { - new KeyValuePair("age", factory.CodeMarkup("12")) + new TagHelperAttributeNode("age", factory.CodeMarkup("12")) })) }, { @@ -982,9 +993,9 @@ public static TheoryData CodeTagHelperAttributesData new MarkupBlock( new MarkupTagHelperBlock("person", TagMode.SelfClosing, - attributes: new List> + attributes: new List { - new KeyValuePair( + new TagHelperAttributeNode( "birthday", factory.CodeMarkup("DateTime.Now")) })) @@ -994,9 +1005,9 @@ public static TheoryData CodeTagHelperAttributesData new MarkupBlock( new MarkupTagHelperBlock("person", TagMode.SelfClosing, - attributes: new List> + attributes: new List { - new KeyValuePair( + new TagHelperAttributeNode( "age", new MarkupBlock( new MarkupBlock( @@ -1013,9 +1024,9 @@ public static TheoryData CodeTagHelperAttributesData new MarkupBlock( new MarkupTagHelperBlock("person", TagMode.SelfClosing, - attributes: new List> + attributes: new List { - new KeyValuePair( + new TagHelperAttributeNode( "age", new MarkupBlock( new MarkupBlock( @@ -1036,9 +1047,9 @@ public static TheoryData CodeTagHelperAttributesData new MarkupBlock( new MarkupTagHelperBlock("person", TagMode.SelfClosing, - attributes: new List> + attributes: new List { - new KeyValuePair("name", factory.Markup("John")) + new TagHelperAttributeNode("name", factory.Markup("John")) })) }, { @@ -1046,9 +1057,9 @@ public static TheoryData CodeTagHelperAttributesData new MarkupBlock( new MarkupTagHelperBlock("person", TagMode.SelfClosing, - attributes: new List> + attributes: new List { - new KeyValuePair( + new TagHelperAttributeNode( "name", new MarkupBlock(factory.Markup("Time:"), dateTimeNow)) })) @@ -1058,9 +1069,9 @@ public static TheoryData CodeTagHelperAttributesData new MarkupBlock( new MarkupTagHelperBlock("person", TagMode.SelfClosing, - attributes: new List> + attributes: new List { - new KeyValuePair( + new TagHelperAttributeNode( "age", new MarkupBlock( factory.CodeMarkup("1"), @@ -1078,7 +1089,7 @@ public static TheoryData CodeTagHelperAttributesData .Accepts(AcceptedCharacters.NonWhiteSpace))), factory.CodeMarkup(" +"), factory.CodeMarkup(" 2"))), - new KeyValuePair( + new TagHelperAttributeNode( "birthday", new MarkupBlock( factory.CodeMarkup("(bool)"), @@ -1110,8 +1121,8 @@ public static TheoryData CodeTagHelperAttributesData factory .Code("DateTime.Now") .AsImplicitExpression(CSharpCodeParser.DefaultKeywords) - .Accepts(AcceptedCharacters.NonWhiteSpace))) - )) + .Accepts(AcceptedCharacters.NonWhiteSpace)))), + HtmlAttributeValueStyle.SingleQuotes) })) }, { @@ -1119,13 +1130,13 @@ public static TheoryData CodeTagHelperAttributesData new MarkupBlock( new MarkupTagHelperBlock("person", TagMode.SelfClosing, - attributes: new List> + attributes: new List { - new KeyValuePair("age", factory.CodeMarkup("12")), - new KeyValuePair( + new TagHelperAttributeNode("age", factory.CodeMarkup("12")), + new TagHelperAttributeNode( "birthday", factory.CodeMarkup("DateTime.Now")), - new KeyValuePair( + new TagHelperAttributeNode( "name", new MarkupBlock(factory.Markup("Time:"), dateTimeNow)) })) @@ -1135,13 +1146,13 @@ public static TheoryData CodeTagHelperAttributesData new MarkupBlock( new MarkupTagHelperBlock("person", TagMode.SelfClosing, - attributes: new List> + attributes: new List { - new KeyValuePair("age", factory.CodeMarkup("12")), - new KeyValuePair( + new TagHelperAttributeNode("age", factory.CodeMarkup("12")), + new TagHelperAttributeNode( "birthday", factory.CodeMarkup("DateTime.Now")), - new KeyValuePair( + new TagHelperAttributeNode( "name", new MarkupBlock( factory.Markup("Time:"), @@ -1158,13 +1169,13 @@ public static TheoryData CodeTagHelperAttributesData new MarkupBlock( new MarkupTagHelperBlock("person", TagMode.SelfClosing, - attributes: new List> + attributes: new List { - new KeyValuePair("age", factory.CodeMarkup("12")), - new KeyValuePair( + new TagHelperAttributeNode("age", factory.CodeMarkup("12")), + new TagHelperAttributeNode( "birthday", factory.CodeMarkup("DateTime.Now")), - new KeyValuePair( + new TagHelperAttributeNode( "name", new MarkupBlock( new MarkupBlock( @@ -1180,9 +1191,9 @@ public static TheoryData CodeTagHelperAttributesData new MarkupBlock( new MarkupTagHelperBlock("person", TagMode.SelfClosing, - attributes: new List> + attributes: new List { - new KeyValuePair( + new TagHelperAttributeNode( "age", new MarkupBlock( new MarkupBlock( @@ -1207,10 +1218,10 @@ public static TheoryData CodeTagHelperAttributesData .Accepts(AcceptedCharacters.None) .As(SpanKind.Code) .With(new MarkupChunkGenerator()))))), - new KeyValuePair( + new TagHelperAttributeNode( "birthday", factory.CodeMarkup("DateTime.Now")), - new KeyValuePair( + new TagHelperAttributeNode( "name", new MarkupBlock(factory.Markup("Time:"), dateTimeNow)) })) @@ -1280,10 +1291,10 @@ public static IEnumerable IncompleteHelperBlockData "

      ", new MarkupBlock( new MarkupTagHelperBlock("p", - new List> + new List { - new KeyValuePair("class", factory.Markup("foo")), - new KeyValuePair( + new TagHelperAttributeNode("class", factory.Markup("foo")), + new TagHelperAttributeNode( "dynamic", new MarkupBlock( new MarkupBlock( @@ -1296,8 +1307,9 @@ public static IEnumerable IncompleteHelperBlockData factory.CodeTransition(), factory.Code("DateTime.Now") .AsImplicitExpression(CSharpCodeParser.DefaultKeywords) - .Accepts(AcceptedCharacters.NonWhiteSpace))))), - new KeyValuePair("style", factory.Markup("color:red;")) + .Accepts(AcceptedCharacters.NonWhiteSpace)))), + HtmlAttributeValueStyle.DoubleQuotes), + new TagHelperAttributeNode("style", factory.Markup("color:red;")) }, new MarkupTagHelperBlock("strong")), blockFactory.MarkupTagBlock("
      ")), @@ -1353,15 +1365,15 @@ public static IEnumerable IncompleteHelperBlockData "

      Hello

      World

      ", new MarkupBlock( new MarkupTagHelperBlock("p", - new List> + new List { - new KeyValuePair("class", factory.Markup("foo")) + new TagHelperAttributeNode("class", factory.Markup("foo")) }, factory.Markup("Hello "), new MarkupTagHelperBlock("p", - new List> + new List { - new KeyValuePair("style", factory.Markup("color:red;")) + new TagHelperAttributeNode("style", factory.Markup("color:red;")) }, factory.Markup("World")))), new RazorError[] @@ -1397,10 +1409,10 @@ public static IEnumerable OddlySpacedBlockData "

      ", new MarkupBlock( new MarkupTagHelperBlock("p", - new List> + new List { - new KeyValuePair("class", factory.Markup(" foo")), - new KeyValuePair( + new TagHelperAttributeNode("class", factory.Markup(" foo")), + new TagHelperAttributeNode( "style", new MarkupBlock( factory.Markup(" color"), @@ -1415,10 +1427,10 @@ public static IEnumerable OddlySpacedBlockData "

      Hello World

      ", new MarkupBlock( new MarkupTagHelperBlock("p", - new List> + new List { - new KeyValuePair("class", factory.Markup(" foo")), - new KeyValuePair( + new TagHelperAttributeNode("class", factory.Markup(" foo")), + new TagHelperAttributeNode( "style", new MarkupBlock( factory.Markup(" color"), @@ -1434,18 +1446,18 @@ public static IEnumerable OddlySpacedBlockData "

      Hello

      World

      ", new MarkupBlock( new MarkupTagHelperBlock("p", - new List> + new List { - new KeyValuePair( + new TagHelperAttributeNode( "class", new MarkupBlock(factory.Markup(" foo"), factory.Markup(" "))) }, factory.Markup("Hello")), factory.Markup(" "), new MarkupTagHelperBlock("p", - new List> + new List { - new KeyValuePair( + new TagHelperAttributeNode( "style", new MarkupBlock(factory.Markup(" color:red;"), factory.Markup(" "))) }, @@ -1512,10 +1524,10 @@ public static IEnumerable ComplexAttributeTagHelperBlockData string.Format(currentFormattedString, dateTimeNowString), new MarkupBlock( new MarkupTagHelperBlock("p", - new List> + new List { - new KeyValuePair("class", dateTimeNow(10)), - new KeyValuePair("style", dateTimeNow(32)) + new TagHelperAttributeNode("class", dateTimeNow(10)), + new TagHelperAttributeNode("style", dateTimeNow(32), HtmlAttributeValueStyle.SingleQuotes) })) }; yield return new object[] @@ -1523,10 +1535,10 @@ public static IEnumerable ComplexAttributeTagHelperBlockData string.Format(currentFormattedString, doWhileString), new MarkupBlock( new MarkupTagHelperBlock("p", - new List> + new List { - new KeyValuePair("class", doWhile(10)), - new KeyValuePair("style", doWhile(83)) + new TagHelperAttributeNode("class", doWhile(10)), + new TagHelperAttributeNode("style", doWhile(83), HtmlAttributeValueStyle.SingleQuotes) })) }; @@ -1536,10 +1548,10 @@ public static IEnumerable ComplexAttributeTagHelperBlockData string.Format(currentFormattedString, dateTimeNowString), new MarkupBlock( new MarkupTagHelperBlock("p", - new List> + new List { - new KeyValuePair("class", dateTimeNow(10)), - new KeyValuePair("style", dateTimeNow(32)) + new TagHelperAttributeNode("class", dateTimeNow(10)), + new TagHelperAttributeNode("style", dateTimeNow(32), HtmlAttributeValueStyle.SingleQuotes) }, factory.Markup("Hello World"))) }; @@ -1548,10 +1560,10 @@ public static IEnumerable ComplexAttributeTagHelperBlockData string.Format(currentFormattedString, doWhileString), new MarkupBlock( new MarkupTagHelperBlock("p", - new List> + new List { - new KeyValuePair("class", doWhile(10)), - new KeyValuePair("style", doWhile(83)) + new TagHelperAttributeNode("class", doWhile(10)), + new TagHelperAttributeNode("style", doWhile(83), HtmlAttributeValueStyle.SingleQuotes) }, factory.Markup("Hello World"))) }; @@ -1562,16 +1574,16 @@ public static IEnumerable ComplexAttributeTagHelperBlockData string.Format(currentFormattedString, dateTimeNowString), new MarkupBlock( new MarkupTagHelperBlock("p", - new List> + new List { - new KeyValuePair("class", dateTimeNow(10)) + new TagHelperAttributeNode("class", dateTimeNow(10)) }, factory.Markup("Hello")), factory.Markup(" "), new MarkupTagHelperBlock("p", - new List> + new List { - new KeyValuePair("style", dateTimeNow(45)) + new TagHelperAttributeNode("style", dateTimeNow(45), HtmlAttributeValueStyle.SingleQuotes) }, factory.Markup("World"))) }; @@ -1580,16 +1592,16 @@ public static IEnumerable ComplexAttributeTagHelperBlockData string.Format(currentFormattedString, doWhileString), new MarkupBlock( new MarkupTagHelperBlock("p", - new List> + new List { - new KeyValuePair("class", doWhile(10)) + new TagHelperAttributeNode("class", doWhile(10)) }, factory.Markup("Hello")), factory.Markup(" "), new MarkupTagHelperBlock("p", - new List> + new List { - new KeyValuePair("style", doWhile(96)) + new TagHelperAttributeNode("style", doWhile(96), HtmlAttributeValueStyle.SingleQuotes) }, factory.Markup("World"))) }; @@ -1601,10 +1613,10 @@ public static IEnumerable ComplexAttributeTagHelperBlockData string.Format(currentFormattedString, dateTimeNowString), new MarkupBlock( new MarkupTagHelperBlock("p", - new List> + new List { - new KeyValuePair("class", dateTimeNow(10)), - new KeyValuePair("style", dateTimeNow(32)) + new TagHelperAttributeNode("class", dateTimeNow(10)), + new TagHelperAttributeNode("style", dateTimeNow(32), HtmlAttributeValueStyle.SingleQuotes) }, factory.Markup("Hello World "), new MarkupTagBlock( @@ -1894,31 +1906,32 @@ public static TheoryData EmptyAttributeTagHelperData "

      ", new MarkupBlock( new MarkupTagHelperBlock("p", - new List> + new List { - new KeyValuePair("class", new MarkupBlock()) + new TagHelperAttributeNode("class", new MarkupBlock()) })) }, { "

      ", new MarkupBlock( new MarkupTagHelperBlock("p", - new List> + new List { - new KeyValuePair("class", new MarkupBlock()) + new TagHelperAttributeNode("class", new MarkupBlock(), HtmlAttributeValueStyle.SingleQuotes) })) }, { "

      ", new MarkupBlock( new MarkupTagHelperBlock("p", - new List> + new List { // We expected a markup node here because attribute values without quotes can only ever // be a single item, hence don't need to be enclosed by a block. - new KeyValuePair( + new TagHelperAttributeNode( "class", - factory.Markup("").With(SpanChunkGenerator.Null)), + factory.Markup("").With(SpanChunkGenerator.Null), + HtmlAttributeValueStyle.DoubleQuotes), })) }, { @@ -1926,13 +1939,14 @@ public static TheoryData EmptyAttributeTagHelperData new MarkupBlock( new MarkupTagHelperBlock("p", TagMode.SelfClosing, - attributes: new List> + attributes: new List { - new KeyValuePair("class1", new MarkupBlock()), - new KeyValuePair( + new TagHelperAttributeNode("class1", new MarkupBlock(), HtmlAttributeValueStyle.SingleQuotes), + new TagHelperAttributeNode( "class2", - factory.Markup(string.Empty).With(SpanChunkGenerator.Null)), - new KeyValuePair("class3", new MarkupBlock()), + factory.Markup(string.Empty).With(SpanChunkGenerator.Null), + HtmlAttributeValueStyle.DoubleQuotes), + new TagHelperAttributeNode("class3", new MarkupBlock()), })) }, { @@ -1940,13 +1954,14 @@ public static TheoryData EmptyAttributeTagHelperData new MarkupBlock( new MarkupTagHelperBlock("p", TagMode.SelfClosing, - attributes: new List> + attributes: new List { - new KeyValuePair("class1", new MarkupBlock()), - new KeyValuePair("class2", new MarkupBlock()), - new KeyValuePair( + new TagHelperAttributeNode("class1", new MarkupBlock(), HtmlAttributeValueStyle.SingleQuotes), + new TagHelperAttributeNode("class2", new MarkupBlock()), + new TagHelperAttributeNode( "class3", - factory.Markup(string.Empty).With(SpanChunkGenerator.Null)), + factory.Markup(string.Empty).With(SpanChunkGenerator.Null), + HtmlAttributeValueStyle.DoubleQuotes), })) }, }; @@ -1979,9 +1994,9 @@ public static TheoryData EmptyTagHelperBoundAttributeData new MarkupTagHelperBlock( "myth", TagMode.SelfClosing, - attributes: new List> + attributes: new List { - new KeyValuePair("bound", new MarkupBlock()) + new TagHelperAttributeNode("bound", new MarkupBlock(), HtmlAttributeValueStyle.SingleQuotes) })), new[] { @@ -1996,9 +2011,9 @@ public static TheoryData EmptyTagHelperBoundAttributeData new MarkupTagHelperBlock( "myth", TagMode.SelfClosing, - attributes: new List> + attributes: new List { - new KeyValuePair("bound", factory.CodeMarkup(" true")) + new TagHelperAttributeNode("bound", factory.CodeMarkup(" true"), HtmlAttributeValueStyle.SingleQuotes) })), new RazorError[0] }, @@ -2008,9 +2023,9 @@ public static TheoryData EmptyTagHelperBoundAttributeData new MarkupTagHelperBlock( "myth", TagMode.SelfClosing, - attributes: new List> + attributes: new List { - new KeyValuePair("bound", factory.CodeMarkup(" ")) + new TagHelperAttributeNode("bound", factory.CodeMarkup(" "), HtmlAttributeValueStyle.SingleQuotes) })), new[] { @@ -2025,10 +2040,10 @@ public static TheoryData EmptyTagHelperBoundAttributeData new MarkupTagHelperBlock( "myth", TagMode.SelfClosing, - attributes: new List> + attributes: new List { - new KeyValuePair("bound", new MarkupBlock()), - new KeyValuePair("bound", new MarkupBlock()) + new TagHelperAttributeNode("bound", new MarkupBlock(), HtmlAttributeValueStyle.SingleQuotes), + new TagHelperAttributeNode("bound", new MarkupBlock()) })), new[] { @@ -2046,10 +2061,10 @@ public static TheoryData EmptyTagHelperBoundAttributeData new MarkupTagHelperBlock( "myth", TagMode.SelfClosing, - attributes: new List> + attributes: new List { - new KeyValuePair("bound", factory.CodeMarkup(" ")), - new KeyValuePair("bound", factory.CodeMarkup(" ")) + new TagHelperAttributeNode("bound", factory.CodeMarkup(" "), HtmlAttributeValueStyle.SingleQuotes), + new TagHelperAttributeNode("bound", factory.CodeMarkup(" ")) })), new[] { @@ -2067,12 +2082,13 @@ public static TheoryData EmptyTagHelperBoundAttributeData new MarkupTagHelperBlock( "myth", TagMode.SelfClosing, - attributes: new List> + attributes: new List { - new KeyValuePair("bound", factory.CodeMarkup("true")), - new KeyValuePair( + new TagHelperAttributeNode("bound", factory.CodeMarkup("true"), HtmlAttributeValueStyle.SingleQuotes), + new TagHelperAttributeNode( "bound", - factory.CodeMarkup(string.Empty).With(SpanChunkGenerator.Null)) + factory.CodeMarkup(string.Empty).With(SpanChunkGenerator.Null), + HtmlAttributeValueStyle.DoubleQuotes) })), new[] { @@ -2087,12 +2103,13 @@ public static TheoryData EmptyTagHelperBoundAttributeData new MarkupTagHelperBlock( "myth", TagMode.SelfClosing, - attributes: new List> + attributes: new List { - new KeyValuePair( + new TagHelperAttributeNode( "bound", - factory.CodeMarkup(string.Empty).With(SpanChunkGenerator.Null)), - new KeyValuePair("name", new MarkupBlock()) + factory.CodeMarkup(string.Empty).With(SpanChunkGenerator.Null), + HtmlAttributeValueStyle.DoubleQuotes), + new TagHelperAttributeNode("name", new MarkupBlock(), HtmlAttributeValueStyle.SingleQuotes) })), new[] { @@ -2107,12 +2124,13 @@ public static TheoryData EmptyTagHelperBoundAttributeData new MarkupTagHelperBlock( "myth", TagMode.SelfClosing, - attributes: new List> + attributes: new List { - new KeyValuePair( + new TagHelperAttributeNode( "bound", - factory.CodeMarkup(string.Empty).With(SpanChunkGenerator.Null)), - new KeyValuePair("name", factory.Markup(" ")) + factory.CodeMarkup(string.Empty).With(SpanChunkGenerator.Null), + HtmlAttributeValueStyle.DoubleQuotes), + new TagHelperAttributeNode("name", factory.Markup(" "), HtmlAttributeValueStyle.SingleQuotes) })), new[] { @@ -2127,16 +2145,18 @@ public static TheoryData EmptyTagHelperBoundAttributeData new MarkupTagHelperBlock( "myth", TagMode.SelfClosing, - attributes: new List> + attributes: new List { - new KeyValuePair("bound", factory.CodeMarkup("true")), - new KeyValuePair("name", factory.Markup("john")), - new KeyValuePair( + new TagHelperAttributeNode("bound", factory.CodeMarkup("true"), HtmlAttributeValueStyle.SingleQuotes), + new TagHelperAttributeNode("name", factory.Markup("john"), HtmlAttributeValueStyle.SingleQuotes), + new TagHelperAttributeNode( "bound", - factory.CodeMarkup(string.Empty).With(SpanChunkGenerator.Null)), - new KeyValuePair( + factory.CodeMarkup(string.Empty).With(SpanChunkGenerator.Null), + HtmlAttributeValueStyle.DoubleQuotes), + new TagHelperAttributeNode( "name", - factory.Markup(string.Empty).With(SpanChunkGenerator.Null)) + factory.Markup(string.Empty).With(SpanChunkGenerator.Null), + HtmlAttributeValueStyle.DoubleQuotes) })), new[] { @@ -2151,9 +2171,9 @@ public static TheoryData EmptyTagHelperBoundAttributeData new MarkupTagHelperBlock( "myth", TagMode.SelfClosing, - attributes: new List> + attributes: new List { - new KeyValuePair("BouND", new MarkupBlock()) + new TagHelperAttributeNode("BouND", new MarkupBlock(), HtmlAttributeValueStyle.SingleQuotes) })), new[] { @@ -2168,10 +2188,10 @@ public static TheoryData EmptyTagHelperBoundAttributeData new MarkupTagHelperBlock( "myth", TagMode.SelfClosing, - attributes: new List> + attributes: new List { - new KeyValuePair("BOUND", new MarkupBlock()), - new KeyValuePair("bOUnd", new MarkupBlock()) + new TagHelperAttributeNode("BOUND", new MarkupBlock(), HtmlAttributeValueStyle.SingleQuotes), + new TagHelperAttributeNode("bOUnd", new MarkupBlock()) })), new[] { @@ -2188,12 +2208,13 @@ public static TheoryData EmptyTagHelperBoundAttributeData new MarkupBlock( new MarkupTagHelperBlock( "myth", - new List> + new List { - new KeyValuePair( + new TagHelperAttributeNode( "BOUND", - factory.CodeMarkup(string.Empty).With(SpanChunkGenerator.Null)), - new KeyValuePair("nAMe", factory.Markup("john")) + factory.CodeMarkup(string.Empty).With(SpanChunkGenerator.Null), + HtmlAttributeValueStyle.DoubleQuotes), + new TagHelperAttributeNode("nAMe", factory.Markup("john"), HtmlAttributeValueStyle.SingleQuotes) })), new[] { @@ -2208,10 +2229,10 @@ public static TheoryData EmptyTagHelperBoundAttributeData new MarkupTagHelperBlock( "myth", TagMode.SelfClosing, - attributes: new List> + attributes: new List { { - new KeyValuePair( + new TagHelperAttributeNode( "bound", new MarkupBlock( new MarkupBlock( @@ -2223,7 +2244,8 @@ public static TheoryData EmptyTagHelperBoundAttributeData factory.Code("true") .AsImplicitExpression(CSharpCodeParser.DefaultKeywords) .Accepts(AcceptedCharacters.NonWhiteSpace))), - factory.CodeMarkup(" "))) + factory.CodeMarkup(" ")), + HtmlAttributeValueStyle.SingleQuotes) } })), new RazorError[0] @@ -2234,10 +2256,10 @@ public static TheoryData EmptyTagHelperBoundAttributeData new MarkupTagHelperBlock( "myth", TagMode.SelfClosing, - attributes: new List> + attributes: new List { { - new KeyValuePair( + new TagHelperAttributeNode( "bound", new MarkupBlock( new MarkupBlock( @@ -2255,7 +2277,8 @@ public static TheoryData EmptyTagHelperBoundAttributeData .Accepts(AcceptedCharacters.None) .As(SpanKind.Code) .With(new MarkupChunkGenerator()))), - factory.CodeMarkup(" "))) + factory.CodeMarkup(" ")), + HtmlAttributeValueStyle.SingleQuotes) } })), new RazorError[0] @@ -2350,10 +2373,10 @@ public static IEnumerable ScriptBlockData new MarkupBlock( new MarkupTagHelperBlock("script", TagMode.SelfClosing, - attributes: new List> + attributes: new List { - new KeyValuePair("class", factory.Markup("foo")), - new KeyValuePair("style", factory.Markup("color:red;")) + new TagHelperAttributeNode("class", factory.Markup("foo")), + new TagHelperAttributeNode("style", factory.Markup("color:red;")) })) }; yield return new object[] @@ -2363,10 +2386,10 @@ public static IEnumerable ScriptBlockData new MarkupTagHelperBlock("p", factory.Markup("Hello "), new MarkupTagHelperBlock("script", - new List> + new List { - new KeyValuePair("class", factory.Markup("foo")), - new KeyValuePair("style", factory.Markup("color:red;")) + new TagHelperAttributeNode("class", factory.Markup("foo")), + new TagHelperAttributeNode("style", factory.Markup("color:red;")) }), factory.Markup(" World"))) }; @@ -2377,16 +2400,16 @@ public static IEnumerable ScriptBlockData new MarkupTagHelperBlock("p", factory.Markup("Hello "), new MarkupTagHelperBlock("script", - new List> + new List { - new KeyValuePair( + new TagHelperAttributeNode( "class", new MarkupBlock( new MarkupBlock( factory.Markup("@").Accepts(AcceptedCharacters.None), factory.Markup("@").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None)), factory.Markup("foo@bar.com"))), - new KeyValuePair("style", factory.Markup("color:red;")) + new TagHelperAttributeNode("style", factory.Markup("color:red;")) }), factory.Markup(" World"))) }; @@ -2414,10 +2437,10 @@ public static IEnumerable SelfClosingBlockData new MarkupBlock( new MarkupTagHelperBlock("p", TagMode.SelfClosing, - attributes: new List> + attributes: new List { - new KeyValuePair("class", factory.Markup("foo")), - new KeyValuePair("style", factory.Markup("color:red;")) + new TagHelperAttributeNode("class", factory.Markup("foo")), + new TagHelperAttributeNode("style", factory.Markup("color:red;")) })) }; yield return new object[] @@ -2433,10 +2456,10 @@ public static IEnumerable SelfClosingBlockData new MarkupTagHelperBlock( "p", TagMode.SelfClosing, - attributes: new List> + attributes: new List { - new KeyValuePair("class", factory.Markup("foo")), - new KeyValuePair( + new TagHelperAttributeNode("class", factory.Markup("foo")), + new TagHelperAttributeNode( "style", factory.Markup("color:red;")) }), @@ -2450,16 +2473,16 @@ public static IEnumerable SelfClosingBlockData factory.Markup("Hello"), new MarkupTagHelperBlock("p", TagMode.SelfClosing, - attributes: new List> + attributes: new List { - new KeyValuePair("class", factory.Markup("foo")) + new TagHelperAttributeNode("class", factory.Markup("foo")) }), factory.Markup(" "), new MarkupTagHelperBlock("p", TagMode.SelfClosing, - attributes: new List> + attributes: new List { - new KeyValuePair("style", factory.Markup("color:red;")) + new TagHelperAttributeNode("style", factory.Markup("color:red;")) }), factory.Markup("World")) }; @@ -2500,11 +2523,11 @@ public static IEnumerable QuotelessAttributeBlockData "

      ", new MarkupBlock( new MarkupTagHelperBlock("p", - new List> + new List { - new KeyValuePair("class", factory.Markup("foo")), - new KeyValuePair("dynamic", dateTimeNow(21)), - new KeyValuePair("style", factory.Markup("color:red;")) + new TagHelperAttributeNode("class", factory.Markup("foo")), + new TagHelperAttributeNode("dynamic", dateTimeNow(21)), + new TagHelperAttributeNode("style", factory.Markup("color:red;")) })) }; yield return new object[] @@ -2512,11 +2535,11 @@ public static IEnumerable QuotelessAttributeBlockData "

      Hello World

      ", new MarkupBlock( new MarkupTagHelperBlock("p", - new List> + new List { - new KeyValuePair("class", factory.Markup("foo")), - new KeyValuePair("dynamic", dateTimeNow(21)), - new KeyValuePair("style", factory.Markup("color:red;")) + new TagHelperAttributeNode("class", factory.Markup("foo")), + new TagHelperAttributeNode("dynamic", dateTimeNow(21)), + new TagHelperAttributeNode("style", factory.Markup("color:red;")) }, factory.Markup("Hello World"))) }; @@ -2525,18 +2548,19 @@ public static IEnumerable QuotelessAttributeBlockData "

      Hello World

      ", new MarkupBlock( new MarkupTagHelperBlock("p", - new List> + new List { - new KeyValuePair("class", factory.Markup("foo")), - new KeyValuePair("dynamic", dateTimeNow(21)), - new KeyValuePair( + new TagHelperAttributeNode("class", factory.Markup("foo")), + new TagHelperAttributeNode("dynamic", dateTimeNow(21)), + new TagHelperAttributeNode( "style", new MarkupBlock( factory.Markup("color"), new MarkupBlock( factory.Markup("@").Accepts(AcceptedCharacters.None), factory.Markup("@").With(SpanChunkGenerator.Null).Accepts(AcceptedCharacters.None)), - factory.Markup(":red;"))) + factory.Markup(":red;")), + HtmlAttributeValueStyle.DoubleQuotes) }, factory.Markup("Hello World"))) }; @@ -2545,18 +2569,18 @@ public static IEnumerable QuotelessAttributeBlockData "

      Hello

      World

      ", new MarkupBlock( new MarkupTagHelperBlock("p", - new List> + new List { - new KeyValuePair("class", factory.Markup("foo")), - new KeyValuePair("dynamic", dateTimeNow(21)) + new TagHelperAttributeNode("class", factory.Markup("foo")), + new TagHelperAttributeNode("dynamic", dateTimeNow(21)) }, factory.Markup("Hello")), factory.Markup(" "), new MarkupTagHelperBlock("p", - new List> + new List { - new KeyValuePair("style", factory.Markup("color:red;")), - new KeyValuePair("dynamic", dateTimeNow(73)) + new TagHelperAttributeNode("style", factory.Markup("color:red;")), + new TagHelperAttributeNode("dynamic", dateTimeNow(73)) }, factory.Markup("World"))) }; @@ -2565,11 +2589,11 @@ public static IEnumerable QuotelessAttributeBlockData "

      Hello World inside of strong tag

      ", new MarkupBlock( new MarkupTagHelperBlock("p", - new List> + new List { - new KeyValuePair("class", factory.Markup("foo")), - new KeyValuePair("dynamic", dateTimeNow(21)), - new KeyValuePair("style", factory.Markup("color:red;")) + new TagHelperAttributeNode("class", factory.Markup("foo")), + new TagHelperAttributeNode("dynamic", dateTimeNow(21)), + new TagHelperAttributeNode("style", factory.Markup("color:red;")) }, factory.Markup("Hello World "), new MarkupTagBlock( @@ -2609,10 +2633,10 @@ public static IEnumerable PlainAttributeBlockData "

      ", new MarkupBlock( new MarkupTagHelperBlock("p", - new List> + new List { - new KeyValuePair("class", factory.Markup("foo")), - new KeyValuePair("style", factory.Markup("color:red;")) + new TagHelperAttributeNode("class", factory.Markup("foo")), + new TagHelperAttributeNode("style", factory.Markup("color:red;")) })) }; yield return new object[] @@ -2620,10 +2644,10 @@ public static IEnumerable PlainAttributeBlockData "

      Hello World

      ", new MarkupBlock( new MarkupTagHelperBlock("p", - new List> + new List { - new KeyValuePair("class", factory.Markup("foo")), - new KeyValuePair("style", factory.Markup("color:red;")) + new TagHelperAttributeNode("class", factory.Markup("foo")), + new TagHelperAttributeNode("style", factory.Markup("color:red;")) }, factory.Markup("Hello World"))) }; @@ -2632,16 +2656,16 @@ public static IEnumerable PlainAttributeBlockData "

      Hello

      World

      ", new MarkupBlock( new MarkupTagHelperBlock("p", - new List> + new List { - new KeyValuePair("class", factory.Markup("foo")) + new TagHelperAttributeNode("class", factory.Markup("foo")) }, factory.Markup("Hello")), factory.Markup(" "), new MarkupTagHelperBlock("p", - new List> + new List { - new KeyValuePair("style", factory.Markup("color:red;")) + new TagHelperAttributeNode("style", factory.Markup("color:red;")) }, factory.Markup("World"))) }; @@ -2650,10 +2674,10 @@ public static IEnumerable PlainAttributeBlockData "

      Hello World inside of strong tag

      ", new MarkupBlock( new MarkupTagHelperBlock("p", - new List> + new List { - new KeyValuePair("class", factory.Markup("foo")), - new KeyValuePair("style", factory.Markup("color:red;")) + new TagHelperAttributeNode("class", factory.Markup("foo")), + new TagHelperAttributeNode("style", factory.Markup("color:red;")) }, factory.Markup("Hello World "), new MarkupTagBlock( @@ -2754,11 +2778,12 @@ public static TheoryData DataDashAttributeData_Document new MarkupTagHelperBlock( "input", TagMode.SelfClosing, - attributes: new List>() + attributes: new List() { - new KeyValuePair( + new TagHelperAttributeNode( "data-required", - new MarkupBlock(dateTimeNow)), + new MarkupBlock(dateTimeNow), + HtmlAttributeValueStyle.SingleQuotes), })) }, { @@ -2767,9 +2792,9 @@ public static TheoryData DataDashAttributeData_Document new MarkupTagHelperBlock( "input", TagMode.SelfClosing, - attributes: new List>() + attributes: new List() { - new KeyValuePair("data-required", factory.Markup("value")), + new TagHelperAttributeNode("data-required", factory.Markup("value"), HtmlAttributeValueStyle.SingleQuotes), })) }, { @@ -2778,11 +2803,12 @@ public static TheoryData DataDashAttributeData_Document new MarkupTagHelperBlock( "input", TagMode.SelfClosing, - attributes: new List>() + attributes: new List() { - new KeyValuePair( + new TagHelperAttributeNode( "data-required", - new MarkupBlock(factory.Markup("prefix "), dateTimeNow)), + new MarkupBlock(factory.Markup("prefix "), dateTimeNow), + HtmlAttributeValueStyle.SingleQuotes), })) }, { @@ -2791,11 +2817,12 @@ public static TheoryData DataDashAttributeData_Document new MarkupTagHelperBlock( "input", TagMode.SelfClosing, - attributes: new List>() + attributes: new List() { - new KeyValuePair( + new TagHelperAttributeNode( "data-required", - new MarkupBlock(dateTimeNow, factory.Markup(" suffix"))), + new MarkupBlock(dateTimeNow, factory.Markup(" suffix")), + HtmlAttributeValueStyle.SingleQuotes), })) }, { @@ -2804,14 +2831,15 @@ public static TheoryData DataDashAttributeData_Document new MarkupTagHelperBlock( "input", TagMode.SelfClosing, - attributes: new List>() + attributes: new List() { - new KeyValuePair( + new TagHelperAttributeNode( "data-required", new MarkupBlock( factory.Markup("prefix "), dateTimeNow, - factory.Markup(" suffix"))), + factory.Markup(" suffix")), + HtmlAttributeValueStyle.SingleQuotes), })) }, { @@ -2820,16 +2848,17 @@ public static TheoryData DataDashAttributeData_Document new MarkupTagHelperBlock( "input", TagMode.SelfClosing, - attributes: new List>() + attributes: new List() { - new KeyValuePair("pre-attribute", value: null), - new KeyValuePair( + new TagHelperAttributeNode("pre-attribute", value: null, valueStyle: HtmlAttributeValueStyle.Minimized), + new TagHelperAttributeNode( "data-required", new MarkupBlock( factory.Markup("prefix "), dateTimeNow, - factory.Markup(" suffix"))), - new KeyValuePair("post-attribute", value: null), + factory.Markup(" suffix")), + HtmlAttributeValueStyle.SingleQuotes), + new TagHelperAttributeNode("post-attribute", value: null, valueStyle: HtmlAttributeValueStyle.Minimized), })) }, { @@ -2838,14 +2867,15 @@ public static TheoryData DataDashAttributeData_Document new MarkupTagHelperBlock( "input", TagMode.SelfClosing, - attributes: new List>() + attributes: new List() { - new KeyValuePair( + new TagHelperAttributeNode( "data-required", new MarkupBlock( dateTimeNow, factory.Markup(" middle "), - dateTimeNow)), + dateTimeNow), + HtmlAttributeValueStyle.SingleQuotes), })) }, }; @@ -2936,9 +2966,9 @@ public static TheoryData MinimizedAttributeData_Document new MarkupTagHelperBlock( "input", TagMode.SelfClosing, - attributes: new List>() + attributes: new List() { - new KeyValuePair("unbound-required", null), + new TagHelperAttributeNode("unbound-required", null, HtmlAttributeValueStyle.Minimized), })), noErrors }, @@ -2948,9 +2978,9 @@ public static TheoryData MinimizedAttributeData_Document new MarkupTagHelperBlock( "p", TagMode.StartTagAndEndTag, - attributes: new List>() + attributes: new List() { - new KeyValuePair("bound-string", null), + new TagHelperAttributeNode("bound-string", null, HtmlAttributeValueStyle.Minimized), })), new[] { @@ -2964,9 +2994,9 @@ public static TheoryData MinimizedAttributeData_Document new MarkupTagHelperBlock( "input", TagMode.SelfClosing, - attributes: new List>() + attributes: new List() { - new KeyValuePair("bound-required-string", null), + new TagHelperAttributeNode("bound-required-string", null, HtmlAttributeValueStyle.Minimized), })), new[] { @@ -2980,9 +3010,9 @@ public static TheoryData MinimizedAttributeData_Document new MarkupTagHelperBlock( "input", TagMode.SelfClosing, - attributes: new List>() + attributes: new List() { - new KeyValuePair("bound-required-int", null), + new TagHelperAttributeNode("bound-required-int", null, HtmlAttributeValueStyle.Minimized), })), new[] { @@ -2996,9 +3026,9 @@ public static TheoryData MinimizedAttributeData_Document new MarkupTagHelperBlock( "p", TagMode.StartTagAndEndTag, - attributes: new List>() + attributes: new List() { - new KeyValuePair("bound-int", null), + new TagHelperAttributeNode("bound-int", null, HtmlAttributeValueStyle.Minimized), })), new[] { new RazorError(string.Format(errorFormat, "bound-int", "p", intType), 3, 0, 3, 9) } }, @@ -3008,9 +3038,9 @@ public static TheoryData MinimizedAttributeData_Document new MarkupTagHelperBlock( "input", TagMode.SelfClosing, - attributes: new List> + attributes: new List { - new KeyValuePair("int-dictionary", null), + new TagHelperAttributeNode("int-dictionary", null, HtmlAttributeValueStyle.Minimized), })), new[] { @@ -3028,9 +3058,9 @@ public static TheoryData MinimizedAttributeData_Document new MarkupTagHelperBlock( "input", TagMode.SelfClosing, - attributes: new List> + attributes: new List { - new KeyValuePair("string-dictionary", null), + new TagHelperAttributeNode("string-dictionary", null, HtmlAttributeValueStyle.Minimized), })), new[] { @@ -3048,9 +3078,9 @@ public static TheoryData MinimizedAttributeData_Document new MarkupTagHelperBlock( "input", TagMode.SelfClosing, - attributes: new List> + attributes: new List { - new KeyValuePair("int-prefix-", null), + new TagHelperAttributeNode("int-prefix-", null, HtmlAttributeValueStyle.Minimized), })), new[] { @@ -3074,9 +3104,9 @@ public static TheoryData MinimizedAttributeData_Document new MarkupTagHelperBlock( "input", TagMode.SelfClosing, - attributes: new List> + attributes: new List { - new KeyValuePair("string-prefix-", null), + new TagHelperAttributeNode("string-prefix-", null, HtmlAttributeValueStyle.Minimized), })), new[] { @@ -3100,9 +3130,9 @@ public static TheoryData MinimizedAttributeData_Document new MarkupTagHelperBlock( "input", TagMode.SelfClosing, - attributes: new List> + attributes: new List { - new KeyValuePair("int-prefix-value", null), + new TagHelperAttributeNode("int-prefix-value", null, HtmlAttributeValueStyle.Minimized), })), new[] { @@ -3120,9 +3150,9 @@ public static TheoryData MinimizedAttributeData_Document new MarkupTagHelperBlock( "input", TagMode.SelfClosing, - attributes: new List> + attributes: new List { - new KeyValuePair("string-prefix-value", null), + new TagHelperAttributeNode("string-prefix-value", null, HtmlAttributeValueStyle.Minimized), })), new[] { @@ -3140,9 +3170,9 @@ public static TheoryData MinimizedAttributeData_Document new MarkupTagHelperBlock( "input", TagMode.SelfClosing, - attributes: new List> + attributes: new List { - new KeyValuePair("int-prefix-value", new MarkupBlock()), + new TagHelperAttributeNode("int-prefix-value", new MarkupBlock(), HtmlAttributeValueStyle.SingleQuotes), })), new[] { @@ -3160,9 +3190,9 @@ public static TheoryData MinimizedAttributeData_Document new MarkupTagHelperBlock( "input", TagMode.SelfClosing, - attributes: new List> + attributes: new List { - new KeyValuePair("string-prefix-value", new MarkupBlock()), + new TagHelperAttributeNode("string-prefix-value", new MarkupBlock(), HtmlAttributeValueStyle.SingleQuotes), })), new RazorError[0] }, @@ -3172,9 +3202,9 @@ public static TheoryData MinimizedAttributeData_Document new MarkupTagHelperBlock( "input", TagMode.SelfClosing, - attributes: new List> + attributes: new List { - new KeyValuePair("int-prefix-value", factory.CodeMarkup("3")), + new TagHelperAttributeNode("int-prefix-value", factory.CodeMarkup("3"), HtmlAttributeValueStyle.SingleQuotes), })), new RazorError[0] }, @@ -3184,11 +3214,14 @@ public static TheoryData MinimizedAttributeData_Document new MarkupTagHelperBlock( "input", TagMode.SelfClosing, - attributes: new List> + attributes: new List { - new KeyValuePair("string-prefix-value", new MarkupBlock( - factory.Markup("some"), - factory.Markup(" string"))), + new TagHelperAttributeNode( + "string-prefix-value", + new MarkupBlock( + factory.Markup("some"), + factory.Markup(" string")), + HtmlAttributeValueStyle.SingleQuotes), })), new RazorError[0] }, @@ -3198,10 +3231,10 @@ public static TheoryData MinimizedAttributeData_Document new MarkupTagHelperBlock( "input", TagMode.SelfClosing, - attributes: new List>() + attributes: new List() { - new KeyValuePair("unbound-required", null), - new KeyValuePair("bound-required-string", null), + new TagHelperAttributeNode("unbound-required", null, HtmlAttributeValueStyle.Minimized), + new TagHelperAttributeNode("bound-required-string", null, HtmlAttributeValueStyle.Minimized), })), new[] { @@ -3219,10 +3252,10 @@ public static TheoryData MinimizedAttributeData_Document new MarkupTagHelperBlock( "p", TagMode.StartTagAndEndTag, - attributes: new List>() + attributes: new List() { - new KeyValuePair("bound-int", null), - new KeyValuePair("bound-string", null), + new TagHelperAttributeNode("bound-int", null, HtmlAttributeValueStyle.Minimized), + new TagHelperAttributeNode("bound-string", null, HtmlAttributeValueStyle.Minimized), })), new[] { @@ -3236,11 +3269,11 @@ public static TheoryData MinimizedAttributeData_Document new MarkupTagHelperBlock( "input", TagMode.SelfClosing, - attributes: new List>() + attributes: new List() { - new KeyValuePair("bound-required-int", null), - new KeyValuePair("unbound-required", null), - new KeyValuePair("bound-required-string", null), + new TagHelperAttributeNode("bound-required-int", null, HtmlAttributeValueStyle.Minimized), + new TagHelperAttributeNode("unbound-required", null, HtmlAttributeValueStyle.Minimized), + new TagHelperAttributeNode("bound-required-string", null, HtmlAttributeValueStyle.Minimized), })), new[] { @@ -3260,11 +3293,11 @@ public static TheoryData MinimizedAttributeData_Document new MarkupTagHelperBlock( "p", TagMode.StartTagAndEndTag, - attributes: new List>() + attributes: new List() { - new KeyValuePair("bound-int", null), - new KeyValuePair("bound-string", null), - new KeyValuePair("bound-string", null), + new TagHelperAttributeNode("bound-int", null, HtmlAttributeValueStyle.Minimized), + new TagHelperAttributeNode("bound-string", null, HtmlAttributeValueStyle.Minimized), + new TagHelperAttributeNode("bound-string", null, HtmlAttributeValueStyle.Minimized), })), new[] { @@ -3279,10 +3312,10 @@ public static TheoryData MinimizedAttributeData_Document new MarkupTagHelperBlock( "input", TagMode.SelfClosing, - attributes: new List>() + attributes: new List() { - new KeyValuePair("unbound-required", null), - new KeyValuePair("class", factory.Markup("btn")), + new TagHelperAttributeNode("unbound-required", null, HtmlAttributeValueStyle.Minimized), + new TagHelperAttributeNode("class", factory.Markup("btn"), HtmlAttributeValueStyle.SingleQuotes), })), noErrors }, @@ -3292,10 +3325,10 @@ public static TheoryData MinimizedAttributeData_Document new MarkupTagHelperBlock( "p", TagMode.StartTagAndEndTag, - attributes: new List>() + attributes: new List() { - new KeyValuePair("bound-string", null), - new KeyValuePair("class", factory.Markup("btn")), + new TagHelperAttributeNode("bound-string", null, HtmlAttributeValueStyle.Minimized), + new TagHelperAttributeNode("class", factory.Markup("btn"), HtmlAttributeValueStyle.SingleQuotes), })), new[] { @@ -3313,10 +3346,10 @@ public static TheoryData MinimizedAttributeData_Document new MarkupTagHelperBlock( "input", TagMode.SelfClosing, - attributes: new List>() + attributes: new List() { - new KeyValuePair("class", factory.Markup("btn")), - new KeyValuePair("unbound-required", null), + new TagHelperAttributeNode("class", factory.Markup("btn"), HtmlAttributeValueStyle.SingleQuotes), + new TagHelperAttributeNode("unbound-required", null, HtmlAttributeValueStyle.Minimized), })), noErrors }, @@ -3326,10 +3359,10 @@ public static TheoryData MinimizedAttributeData_Document new MarkupTagHelperBlock( "p", TagMode.StartTagAndEndTag, - attributes: new List>() + attributes: new List() { - new KeyValuePair("class", factory.Markup("btn")), - new KeyValuePair("bound-string", null), + new TagHelperAttributeNode("class", factory.Markup("btn"), HtmlAttributeValueStyle.SingleQuotes), + new TagHelperAttributeNode("bound-string", null, HtmlAttributeValueStyle.Minimized), })), new[] { @@ -3347,10 +3380,10 @@ public static TheoryData MinimizedAttributeData_Document new MarkupTagHelperBlock( "input", TagMode.SelfClosing, - attributes: new List>() + attributes: new List() { - new KeyValuePair("bound-required-string", null), - new KeyValuePair("class", factory.Markup("btn")), + new TagHelperAttributeNode("bound-required-string", null, HtmlAttributeValueStyle.Minimized), + new TagHelperAttributeNode("class", factory.Markup("btn"), HtmlAttributeValueStyle.SingleQuotes), })), new[] { @@ -3368,10 +3401,10 @@ public static TheoryData MinimizedAttributeData_Document new MarkupTagHelperBlock( "input", TagMode.SelfClosing, - attributes: new List>() + attributes: new List() { - new KeyValuePair("class", factory.Markup("btn")), - new KeyValuePair("bound-required-string", null), + new TagHelperAttributeNode("class", factory.Markup("btn"), HtmlAttributeValueStyle.SingleQuotes), + new TagHelperAttributeNode("bound-required-string", null, HtmlAttributeValueStyle.Minimized), })), new[] { @@ -3389,10 +3422,10 @@ public static TheoryData MinimizedAttributeData_Document new MarkupTagHelperBlock( "input", TagMode.SelfClosing, - attributes: new List>() + attributes: new List() { - new KeyValuePair("bound-required-int", null), - new KeyValuePair("class", factory.Markup("btn")), + new TagHelperAttributeNode("bound-required-int", null, HtmlAttributeValueStyle.Minimized), + new TagHelperAttributeNode("class", factory.Markup("btn"), HtmlAttributeValueStyle.SingleQuotes), })), new[] { @@ -3406,10 +3439,10 @@ public static TheoryData MinimizedAttributeData_Document new MarkupTagHelperBlock( "p", TagMode.StartTagAndEndTag, - attributes: new List>() + attributes: new List() { - new KeyValuePair("bound-int", null), - new KeyValuePair("class", factory.Markup("btn")), + new TagHelperAttributeNode("bound-int", null, HtmlAttributeValueStyle.Minimized), + new TagHelperAttributeNode("class", factory.Markup("btn"), HtmlAttributeValueStyle.SingleQuotes), })), new[] { @@ -3422,10 +3455,10 @@ public static TheoryData MinimizedAttributeData_Document new MarkupTagHelperBlock( "input", TagMode.SelfClosing, - attributes: new List>() + attributes: new List() { - new KeyValuePair("class", factory.Markup("btn")), - new KeyValuePair("bound-required-int", null), + new TagHelperAttributeNode("class", factory.Markup("btn"), HtmlAttributeValueStyle.SingleQuotes), + new TagHelperAttributeNode("bound-required-int", null, HtmlAttributeValueStyle.Minimized), })), new[] { @@ -3438,10 +3471,10 @@ public static TheoryData MinimizedAttributeData_Document new MarkupTagHelperBlock( "p", TagMode.StartTagAndEndTag, - attributes: new List>() + attributes: new List() { - new KeyValuePair("class", factory.Markup("btn")), - new KeyValuePair("bound-int", null), + new TagHelperAttributeNode("class", factory.Markup("btn"), HtmlAttributeValueStyle.SingleQuotes), + new TagHelperAttributeNode("bound-int", null, HtmlAttributeValueStyle.Minimized), })), new[] { @@ -3454,10 +3487,10 @@ public static TheoryData MinimizedAttributeData_Document new MarkupTagHelperBlock( "input", TagMode.SelfClosing, - attributes: new List>() + attributes: new List() { - new KeyValuePair("class", expression(14)), - new KeyValuePair("bound-required-int", null), + new TagHelperAttributeNode("class", expression(14), HtmlAttributeValueStyle.SingleQuotes), + new TagHelperAttributeNode("bound-required-int", null, HtmlAttributeValueStyle.Minimized), })), new[] { @@ -3471,10 +3504,10 @@ public static TheoryData MinimizedAttributeData_Document new MarkupTagHelperBlock( "p", TagMode.StartTagAndEndTag, - attributes: new List>() + attributes: new List() { - new KeyValuePair("class", expression(10)), - new KeyValuePair("bound-int", null), + new TagHelperAttributeNode("class", expression(10), HtmlAttributeValueStyle.SingleQuotes), + new TagHelperAttributeNode("bound-int", null, HtmlAttributeValueStyle.Minimized), })), new[] { @@ -3488,13 +3521,13 @@ public static TheoryData MinimizedAttributeData_Document new MarkupTagHelperBlock( "input", TagMode.SelfClosing, - attributes: new List>() + attributes: new List() { - new KeyValuePair("bound-required-int", null), - new KeyValuePair("class", expression(36)), - new KeyValuePair("bound-required-string", null), - new KeyValuePair("class", expression(86)), - new KeyValuePair("unbound-required", null), + new TagHelperAttributeNode("bound-required-int", null, HtmlAttributeValueStyle.Minimized), + new TagHelperAttributeNode("class", expression(36), HtmlAttributeValueStyle.SingleQuotes), + new TagHelperAttributeNode("bound-required-string", null, HtmlAttributeValueStyle.Minimized), + new TagHelperAttributeNode("class", expression(86), HtmlAttributeValueStyle.SingleQuotes), + new TagHelperAttributeNode("unbound-required", null, HtmlAttributeValueStyle.Minimized), })), new[] { @@ -3515,13 +3548,13 @@ public static TheoryData MinimizedAttributeData_Document new MarkupTagHelperBlock( "p", TagMode.StartTagAndEndTag, - attributes: new List>() + attributes: new List() { - new KeyValuePair("bound-int", null), - new KeyValuePair("class", expression(23)), - new KeyValuePair("bound-string", null), - new KeyValuePair("class", expression(64)), - new KeyValuePair("bound-string", null), + new TagHelperAttributeNode("bound-int", null, HtmlAttributeValueStyle.Minimized), + new TagHelperAttributeNode("class", expression(23), HtmlAttributeValueStyle.SingleQuotes), + new TagHelperAttributeNode("bound-string", null, HtmlAttributeValueStyle.Minimized), + new TagHelperAttributeNode("class", expression(64), HtmlAttributeValueStyle.SingleQuotes), + new TagHelperAttributeNode("bound-string", null, HtmlAttributeValueStyle.Minimized), })), new[] { @@ -3617,9 +3650,10 @@ public static TheoryData MinimizedAttributeData_CSharpBlock } } - tagHelperBlock.Attributes[i] = new KeyValuePair( - attribute.Key, - blockBuilder.Build()); + tagHelperBlock.Attributes[i] = new TagHelperAttributeNode( + attribute.Name, + blockBuilder.Build(), + attribute.ValueStyle); } } } @@ -3669,9 +3703,9 @@ public static TheoryData MinimizedAttributeData_PartialTags new MarkupTagHelperBlock( "input", TagMode.StartTagAndEndTag, - attributes: new List>() + attributes: new List() { - new KeyValuePair("unbound-required", null), + new TagHelperAttributeNode("unbound-required", null, HtmlAttributeValueStyle.Minimized), })), new[] { @@ -3691,9 +3725,9 @@ public static TheoryData MinimizedAttributeData_PartialTags new MarkupTagHelperBlock( "input", TagMode.StartTagAndEndTag, - attributes: new List>() + attributes: new List() { - new KeyValuePair("bound-required-string", null), + new TagHelperAttributeNode("bound-required-string", null, HtmlAttributeValueStyle.Minimized), })), new[] { @@ -3719,9 +3753,9 @@ public static TheoryData MinimizedAttributeData_PartialTags new MarkupTagHelperBlock( "input", TagMode.StartTagAndEndTag, - attributes: new List>() + attributes: new List() { - new KeyValuePair("bound-required-int", null), + new TagHelperAttributeNode("bound-required-int", null, HtmlAttributeValueStyle.Minimized), })), new[] { @@ -3747,11 +3781,11 @@ public static TheoryData MinimizedAttributeData_PartialTags new MarkupTagHelperBlock( "input", TagMode.StartTagAndEndTag, - attributes: new List>() + attributes: new List() { - new KeyValuePair("bound-required-int", null), - new KeyValuePair("unbound-required", null), - new KeyValuePair("bound-required-string", null), + new TagHelperAttributeNode("bound-required-int", null, HtmlAttributeValueStyle.Minimized), + new TagHelperAttributeNode("unbound-required", null, HtmlAttributeValueStyle.Minimized), + new TagHelperAttributeNode("bound-required-string", null, HtmlAttributeValueStyle.Minimized), })), new[] { @@ -3783,9 +3817,9 @@ public static TheoryData MinimizedAttributeData_PartialTags new MarkupTagHelperBlock( "p", TagMode.StartTagAndEndTag, - attributes: new List>() + attributes: new List() { - new KeyValuePair("bound-string", null), + new TagHelperAttributeNode("bound-string", null, HtmlAttributeValueStyle.Minimized), })), new[] { @@ -3807,9 +3841,9 @@ public static TheoryData MinimizedAttributeData_PartialTags new MarkupTagHelperBlock( "p", TagMode.StartTagAndEndTag, - attributes: new List>() + attributes: new List() { - new KeyValuePair("bound-int", null), + new TagHelperAttributeNode("bound-int", null, HtmlAttributeValueStyle.Minimized), })), new[] { @@ -3830,10 +3864,10 @@ public static TheoryData MinimizedAttributeData_PartialTags new MarkupTagHelperBlock( "p", TagMode.StartTagAndEndTag, - attributes: new List>() + attributes: new List() { - new KeyValuePair("bound-int", null), - new KeyValuePair("bound-string", null), + new TagHelperAttributeNode("bound-int", null, HtmlAttributeValueStyle.Minimized), + new TagHelperAttributeNode("bound-string", null, HtmlAttributeValueStyle.Minimized), })), new[] { @@ -3856,19 +3890,19 @@ public static TheoryData MinimizedAttributeData_PartialTags new MarkupTagHelperBlock( "input", TagMode.StartTagAndEndTag, - attributes: new List>() + attributes: new List() { - new KeyValuePair("bound-required-int", null), - new KeyValuePair("unbound-required", null), - new KeyValuePair("bound-required-string", null), + new TagHelperAttributeNode("bound-required-int", null, HtmlAttributeValueStyle.Minimized), + new TagHelperAttributeNode("unbound-required", null, HtmlAttributeValueStyle.Minimized), + new TagHelperAttributeNode("bound-required-string", null, HtmlAttributeValueStyle.Minimized), }, children: new MarkupTagHelperBlock( "p", TagMode.StartTagAndEndTag, - attributes: new List>() + attributes: new List() { - new KeyValuePair("bound-int", null), - new KeyValuePair("bound-string", null), + new TagHelperAttributeNode("bound-int", null, HtmlAttributeValueStyle.Minimized), + new TagHelperAttributeNode("bound-string", null, HtmlAttributeValueStyle.Minimized), }))), new[] { diff --git a/test/Microsoft.AspNetCore.Razor.Test/TagHelpers/TagHelperParseTreeRewriterTest.cs b/test/Microsoft.AspNetCore.Razor.Test/TagHelpers/TagHelperParseTreeRewriterTest.cs index f9586621c..4d5c982cc 100644 --- a/test/Microsoft.AspNetCore.Razor.Test/TagHelpers/TagHelperParseTreeRewriterTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Test/TagHelpers/TagHelperParseTreeRewriterTest.cs @@ -14,6 +14,7 @@ using Microsoft.AspNetCore.Razor.Text; using Xunit; using Microsoft.AspNetCore.Razor.Parser.TagHelpers.Internal; +using Microsoft.AspNetCore.Razor.Parser.TagHelpers; namespace Microsoft.AspNetCore.Razor.Test.TagHelpers { @@ -766,9 +767,9 @@ public void Rewrite_RecoversWhenRequiredAttributeMismatchAndRestrictedChildren() }; var expectedOutput = new MarkupBlock( new MarkupTagHelperBlock("strong", - new List> + new List { - new KeyValuePair("required", null) + new TagHelperAttributeNode("required", null, HtmlAttributeValueStyle.Minimized) }, blockFactory.MarkupTagBlock(""), blockFactory.MarkupTagBlock(""))); @@ -1351,9 +1352,9 @@ public static TheoryData RequiredAttributeData new MarkupTagHelperBlock( "p", tagMode: TagMode.SelfClosing, - attributes: new List> + attributes: new List { - new KeyValuePair("class", factory.Markup("btn")) + new TagHelperAttributeNode("class", factory.Markup("btn")) })) }, { @@ -1362,9 +1363,9 @@ public static TheoryData RequiredAttributeData new MarkupTagHelperBlock( "p", tagMode: TagMode.SelfClosing, - attributes: new List> + attributes: new List { - new KeyValuePair("class", dateTimeNow(10)) + new TagHelperAttributeNode("class", dateTimeNow(10)) })) }, { @@ -1372,9 +1373,9 @@ public static TheoryData RequiredAttributeData new MarkupBlock( new MarkupTagHelperBlock( "p", - attributes: new List> + attributes: new List { - new KeyValuePair("class", factory.Markup("btn")) + new TagHelperAttributeNode("class", factory.Markup("btn")) }, children: factory.Markup("words and spaces"))) }, @@ -1383,9 +1384,9 @@ public static TheoryData RequiredAttributeData new MarkupBlock( new MarkupTagHelperBlock( "p", - attributes: new List> + attributes: new List { - new KeyValuePair("class", dateTimeNow(10)) + new TagHelperAttributeNode("class", dateTimeNow(10)) }, children: factory.Markup("words and spaces"))) }, @@ -1394,9 +1395,9 @@ public static TheoryData RequiredAttributeData new MarkupBlock( new MarkupTagHelperBlock( "p", - attributes: new List> + attributes: new List { - new KeyValuePair("class", factory.Markup("btn")) + new TagHelperAttributeNode("class", factory.Markup("btn")) }, children: new SyntaxTreeNode[] { @@ -1413,9 +1414,9 @@ public static TheoryData RequiredAttributeData new MarkupTagHelperBlock( "strong", tagMode: TagMode.SelfClosing, - attributes: new List> + attributes: new List { - new KeyValuePair("catchAll", factory.Markup("hi")) + new TagHelperAttributeNode("catchAll", factory.Markup("hi")) })) }, { @@ -1424,9 +1425,9 @@ public static TheoryData RequiredAttributeData new MarkupTagHelperBlock( "strong", tagMode: TagMode.SelfClosing, - attributes: new List> + attributes: new List { - new KeyValuePair("catchAll", dateTimeNow(18)) + new TagHelperAttributeNode("catchAll", dateTimeNow(18)) })) }, { @@ -1434,9 +1435,9 @@ public static TheoryData RequiredAttributeData new MarkupBlock( new MarkupTagHelperBlock( "strong", - attributes: new List> + attributes: new List { - new KeyValuePair("catchAll", factory.Markup("hi")) + new TagHelperAttributeNode("catchAll", factory.Markup("hi")) }, children: factory.Markup("words and spaces"))) }, @@ -1445,9 +1446,9 @@ public static TheoryData RequiredAttributeData new MarkupBlock( new MarkupTagHelperBlock( "strong", - attributes: new List> + attributes: new List { - new KeyValuePair("catchAll", dateTimeNow(18)) + new TagHelperAttributeNode("catchAll", dateTimeNow(18)) }, children: factory.Markup("words and spaces"))) }, @@ -1494,10 +1495,10 @@ public static TheoryData RequiredAttributeData new MarkupTagHelperBlock( "p", tagMode: TagMode.SelfClosing, - attributes: new List> + attributes: new List { - new KeyValuePair("notRequired", factory.Markup("a")), - new KeyValuePair("class", factory.Markup("btn")) + new TagHelperAttributeNode("notRequired", factory.Markup("a")), + new TagHelperAttributeNode("class", factory.Markup("btn")) })) }, { @@ -1506,10 +1507,10 @@ public static TheoryData RequiredAttributeData new MarkupTagHelperBlock( "p", tagMode: TagMode.SelfClosing, - attributes: new List> + attributes: new List { - new KeyValuePair("notRequired", dateTimeNow(16)), - new KeyValuePair("class", factory.Markup("btn")) + new TagHelperAttributeNode("notRequired", dateTimeNow(16)), + new TagHelperAttributeNode("class", factory.Markup("btn")) })) }, { @@ -1517,10 +1518,10 @@ public static TheoryData RequiredAttributeData new MarkupBlock( new MarkupTagHelperBlock( "p", - attributes: new List> + attributes: new List { - new KeyValuePair("notRequired", factory.Markup("a")), - new KeyValuePair("class", factory.Markup("btn")) + new TagHelperAttributeNode("notRequired", factory.Markup("a")), + new TagHelperAttributeNode("class", factory.Markup("btn")) }, children: factory.Markup("words and spaces"))) }, @@ -1530,10 +1531,10 @@ public static TheoryData RequiredAttributeData new MarkupTagHelperBlock( "div", tagMode: TagMode.SelfClosing, - attributes: new List> + attributes: new List { - new KeyValuePair("style", new MarkupBlock()), - new KeyValuePair("class", factory.Markup("btn")) + new TagHelperAttributeNode("style", new MarkupBlock()), + new TagHelperAttributeNode("class", factory.Markup("btn")) })) }, { @@ -1542,10 +1543,10 @@ public static TheoryData RequiredAttributeData new MarkupTagHelperBlock( "div", tagMode: TagMode.SelfClosing, - attributes: new List> + attributes: new List { - new KeyValuePair("style", dateTimeNow(12)), - new KeyValuePair("class", factory.Markup("btn")) + new TagHelperAttributeNode("style", dateTimeNow(12)), + new TagHelperAttributeNode("class", factory.Markup("btn")) })) }, { @@ -1553,10 +1554,10 @@ public static TheoryData RequiredAttributeData new MarkupBlock( new MarkupTagHelperBlock( "div", - attributes: new List> + attributes: new List { - new KeyValuePair("style", new MarkupBlock()), - new KeyValuePair("class", factory.Markup("btn")) + new TagHelperAttributeNode("style", new MarkupBlock()), + new TagHelperAttributeNode("class", factory.Markup("btn")) }, children: factory.Markup("words and spaces"))) }, @@ -1565,10 +1566,10 @@ public static TheoryData RequiredAttributeData new MarkupBlock( new MarkupTagHelperBlock( "div", - attributes: new List> + attributes: new List { - new KeyValuePair("style", dateTimeNow(12)), - new KeyValuePair("class", dateTimeNow(34)) + new TagHelperAttributeNode("style", dateTimeNow(12)), + new TagHelperAttributeNode("class", dateTimeNow(34)) }, children: factory.Markup("words and spaces"))) }, @@ -1577,10 +1578,10 @@ public static TheoryData RequiredAttributeData new MarkupBlock( new MarkupTagHelperBlock( "div", - attributes: new List> + attributes: new List { - new KeyValuePair("style", new MarkupBlock()), - new KeyValuePair("class", factory.Markup("btn")) + new TagHelperAttributeNode("style", new MarkupBlock()), + new TagHelperAttributeNode("class", factory.Markup("btn")) }, children: new SyntaxTreeNode[] { @@ -1597,10 +1598,10 @@ public static TheoryData RequiredAttributeData new MarkupTagHelperBlock( "p", tagMode: TagMode.SelfClosing, - attributes: new List> + attributes: new List { - new KeyValuePair("class", factory.Markup("btn")), - new KeyValuePair("catchAll", factory.Markup("hi")) + new TagHelperAttributeNode("class", factory.Markup("btn")), + new TagHelperAttributeNode("catchAll", factory.Markup("hi")) })) }, { @@ -1608,10 +1609,10 @@ public static TheoryData RequiredAttributeData new MarkupBlock( new MarkupTagHelperBlock( "p", - attributes: new List> + attributes: new List { - new KeyValuePair("class", factory.Markup("btn")), - new KeyValuePair("catchAll", factory.Markup("hi")) + new TagHelperAttributeNode("class", factory.Markup("btn")), + new TagHelperAttributeNode("catchAll", factory.Markup("hi")) }, children: factory.Markup("words and spaces"))) }, @@ -1621,11 +1622,11 @@ public static TheoryData RequiredAttributeData new MarkupTagHelperBlock( "div", tagMode: TagMode.SelfClosing, - attributes: new List> + attributes: new List { - new KeyValuePair("style", new MarkupBlock()), - new KeyValuePair("class", factory.Markup("btn")), - new KeyValuePair("catchAll", factory.Markup("hi")) + new TagHelperAttributeNode("style", new MarkupBlock()), + new TagHelperAttributeNode("class", factory.Markup("btn")), + new TagHelperAttributeNode("catchAll", factory.Markup("hi")) })) }, { @@ -1633,11 +1634,11 @@ public static TheoryData RequiredAttributeData new MarkupBlock( new MarkupTagHelperBlock( "div", - attributes: new List> + attributes: new List { - new KeyValuePair("style", new MarkupBlock()), - new KeyValuePair("class", factory.Markup("btn")), - new KeyValuePair("catchAll", factory.Markup("hi")) + new TagHelperAttributeNode("style", new MarkupBlock()), + new TagHelperAttributeNode("class", factory.Markup("btn")), + new TagHelperAttributeNode("catchAll", factory.Markup("hi")) }, children: factory.Markup("words and spaces"))) }, @@ -1646,11 +1647,11 @@ public static TheoryData RequiredAttributeData new MarkupBlock( new MarkupTagHelperBlock( "div", - attributes: new List> + attributes: new List { - new KeyValuePair("style", new MarkupBlock()), - new KeyValuePair("class", factory.Markup("btn")), - new KeyValuePair("catchAll", + new TagHelperAttributeNode("style", new MarkupBlock()), + new TagHelperAttributeNode("class", factory.Markup("btn")), + new TagHelperAttributeNode("catchAll", new MarkupBlock( new MarkupBlock( factory.Markup("@").Accepts(AcceptedCharacters.None), @@ -1665,11 +1666,11 @@ public static TheoryData RequiredAttributeData new MarkupBlock( new MarkupTagHelperBlock( "div", - attributes: new List> + attributes: new List { - new KeyValuePair("style", dateTimeNow(12)), - new KeyValuePair("class", dateTimeNow(34)), - new KeyValuePair("catchAll", dateTimeNow(59)) + new TagHelperAttributeNode("style", dateTimeNow(12)), + new TagHelperAttributeNode("class", dateTimeNow(34)), + new TagHelperAttributeNode("catchAll", dateTimeNow(59)) }, children: factory.Markup("words and spaces"))) }, @@ -1678,11 +1679,11 @@ public static TheoryData RequiredAttributeData new MarkupBlock( new MarkupTagHelperBlock( "div", - attributes: new List> + attributes: new List { - new KeyValuePair("style", new MarkupBlock()), - new KeyValuePair("class", factory.Markup("btn")), - new KeyValuePair("catchAll", factory.Markup("hi")) + new TagHelperAttributeNode("style", new MarkupBlock()), + new TagHelperAttributeNode("class", factory.Markup("btn")), + new TagHelperAttributeNode("catchAll", factory.Markup("hi")) }, children: new SyntaxTreeNode[] { @@ -1760,9 +1761,9 @@ public static TheoryData NestedRequiredAttributeData new MarkupBlock( new MarkupTagHelperBlock( "p", - attributes: new List> + attributes: new List { - new KeyValuePair("class", factory.Markup("btn")) + new TagHelperAttributeNode("class", factory.Markup("btn")) }, children: new[] { @@ -1775,9 +1776,9 @@ public static TheoryData NestedRequiredAttributeData new MarkupBlock( new MarkupTagHelperBlock( "strong", - attributes: new List> + attributes: new List { - new KeyValuePair("catchAll", factory.Markup("hi")) + new TagHelperAttributeNode("catchAll", factory.Markup("hi")) }, children: new SyntaxTreeNode[] { @@ -1790,9 +1791,9 @@ public static TheoryData NestedRequiredAttributeData new MarkupBlock( new MarkupTagHelperBlock( "p", - attributes: new List> + attributes: new List { - new KeyValuePair("class", factory.Markup("btn")) + new TagHelperAttributeNode("class", factory.Markup("btn")) }, children: new[] { @@ -1807,9 +1808,9 @@ public static TheoryData NestedRequiredAttributeData new MarkupBlock( new MarkupTagHelperBlock( "strong", - attributes: new List> + attributes: new List { - new KeyValuePair("catchAll", factory.Markup("hi")) + new TagHelperAttributeNode("catchAll", factory.Markup("hi")) }, children: new SyntaxTreeNode[] { @@ -1824,15 +1825,15 @@ public static TheoryData NestedRequiredAttributeData new MarkupBlock( new MarkupTagHelperBlock( "p", - attributes: new List> + attributes: new List { - new KeyValuePair("class", factory.Markup("btn")) + new TagHelperAttributeNode("class", factory.Markup("btn")) }, children: new MarkupTagHelperBlock( "strong", - attributes: new List> + attributes: new List { - new KeyValuePair("catchAll", factory.Markup("hi")) + new TagHelperAttributeNode("catchAll", factory.Markup("hi")) }, children: new[] { @@ -1845,15 +1846,15 @@ public static TheoryData NestedRequiredAttributeData new MarkupBlock( new MarkupTagHelperBlock( "strong", - attributes: new List> + attributes: new List { - new KeyValuePair("catchAll", factory.Markup("hi")) + new TagHelperAttributeNode("catchAll", factory.Markup("hi")) }, children: new MarkupTagHelperBlock( "p", - attributes: new List> + attributes: new List { - new KeyValuePair("class", factory.Markup("btn")) + new TagHelperAttributeNode("class", factory.Markup("btn")) }, children: new[] { @@ -1866,15 +1867,15 @@ public static TheoryData NestedRequiredAttributeData new MarkupBlock( new MarkupTagHelperBlock( "p", - attributes: new List> + attributes: new List { - new KeyValuePair("class", factory.Markup("btn")) + new TagHelperAttributeNode("class", factory.Markup("btn")) }, children: new MarkupTagHelperBlock( "p", - attributes: new List> + attributes: new List { - new KeyValuePair("class", factory.Markup("btn")) + new TagHelperAttributeNode("class", factory.Markup("btn")) }, children: new[] { @@ -1887,15 +1888,15 @@ public static TheoryData NestedRequiredAttributeData new MarkupBlock( new MarkupTagHelperBlock( "strong", - attributes: new List> + attributes: new List { - new KeyValuePair("catchAll", factory.Markup("hi")) + new TagHelperAttributeNode("catchAll", factory.Markup("hi")) }, children: new MarkupTagHelperBlock( "strong", - attributes: new List> + attributes: new List { - new KeyValuePair("catchAll", factory.Markup("hi")) + new TagHelperAttributeNode("catchAll", factory.Markup("hi")) }, children: new[] { @@ -1908,9 +1909,9 @@ public static TheoryData NestedRequiredAttributeData new MarkupBlock( new MarkupTagHelperBlock( "p", - attributes: new List> + attributes: new List { - new KeyValuePair("class", factory.Markup("btn")) + new TagHelperAttributeNode("class", factory.Markup("btn")) }, children: new[] { @@ -1918,9 +1919,9 @@ public static TheoryData NestedRequiredAttributeData blockFactory.MarkupTagBlock("

      "), new MarkupTagHelperBlock( "p", - attributes: new List> + attributes: new List { - new KeyValuePair("class", factory.Markup("btn")) + new TagHelperAttributeNode("class", factory.Markup("btn")) }, children: new[] { @@ -1937,9 +1938,9 @@ public static TheoryData NestedRequiredAttributeData new MarkupBlock( new MarkupTagHelperBlock( "strong", - attributes: new List> + attributes: new List { - new KeyValuePair("catchAll", factory.Markup("hi")) + new TagHelperAttributeNode("catchAll", factory.Markup("hi")) }, children: new[] { @@ -1947,9 +1948,9 @@ public static TheoryData NestedRequiredAttributeData blockFactory.MarkupTagBlock(""), new MarkupTagHelperBlock( "strong", - attributes: new List> + attributes: new List { - new KeyValuePair("catchAll", factory.Markup("hi")) + new TagHelperAttributeNode("catchAll", factory.Markup("hi")) }, children: new[] { @@ -2017,9 +2018,9 @@ public static TheoryData MalformedRequiredAtt new MarkupBlock( new MarkupTagHelperBlock( "p", - attributes: new List> + attributes: new List { - new KeyValuePair("class", factory.Markup("btn")) + new TagHelperAttributeNode("class", factory.Markup("btn")) })), new[] { @@ -2038,10 +2039,10 @@ public static TheoryData MalformedRequiredAtt new MarkupBlock( new MarkupTagHelperBlock( "p", - attributes: new List> + attributes: new List { - new KeyValuePair("notRequired", factory.Markup("hi")), - new KeyValuePair("class", factory.Markup("btn")) + new TagHelperAttributeNode("notRequired", factory.Markup("hi")), + new TagHelperAttributeNode("class", factory.Markup("btn")) })), new[] { @@ -2067,9 +2068,9 @@ public static TheoryData MalformedRequiredAtt new MarkupBlock( new MarkupTagHelperBlock( "p", - attributes: new List> + attributes: new List { - new KeyValuePair("class", factory.Markup("btn")) + new TagHelperAttributeNode("class", factory.Markup("btn")) })), new[] { @@ -2084,10 +2085,10 @@ public static TheoryData MalformedRequiredAtt new MarkupBlock( new MarkupTagHelperBlock( "p", - attributes: new List> + attributes: new List { - new KeyValuePair("notRequired", factory.Markup("hi")), - new KeyValuePair("class", factory.Markup("btn")) + new TagHelperAttributeNode("notRequired", factory.Markup("hi")), + new TagHelperAttributeNode("class", factory.Markup("btn")) })), new[] { @@ -2101,9 +2102,9 @@ public static TheoryData MalformedRequiredAtt "

      ", new MarkupBlock( new MarkupTagHelperBlock("p", - attributes: new List> + attributes: new List { - new KeyValuePair("class", factory.Markup("btn")) + new TagHelperAttributeNode("class", factory.Markup("btn")) }, children: blockFactory.MarkupTagBlock("

      "))), new[] @@ -2122,10 +2123,10 @@ public static TheoryData MalformedRequiredAtt "

      ", new MarkupBlock( new MarkupTagHelperBlock("p", - attributes: new List> + attributes: new List { - new KeyValuePair("notRequired", factory.Markup("hi")), - new KeyValuePair("class", factory.Markup("btn")) + new TagHelperAttributeNode("notRequired", factory.Markup("hi")), + new TagHelperAttributeNode("class", factory.Markup("btn")) }, children: blockFactory.MarkupTagBlock("

      "))), new[] @@ -2145,9 +2146,9 @@ public static TheoryData MalformedRequiredAtt new MarkupBlock( new MarkupTagHelperBlock( "p", - attributes: new List> + attributes: new List { - new KeyValuePair("class", factory.Markup("btn")) + new TagHelperAttributeNode("class", factory.Markup("btn")) })), new[] { @@ -2166,10 +2167,10 @@ public static TheoryData MalformedRequiredAtt new MarkupBlock( new MarkupTagHelperBlock( "p", - attributes: new List> + attributes: new List { - new KeyValuePair("notRequired", factory.Markup("hi")), - new KeyValuePair("class", factory.Markup("btn")) + new TagHelperAttributeNode("notRequired", factory.Markup("hi")), + new TagHelperAttributeNode("class", factory.Markup("btn")) })), new[] { @@ -2370,9 +2371,9 @@ public static TheoryData PrefixedTagHelperBoundData new MarkupTagHelperBlock( "th:myth", tagMode: TagMode.SelfClosing, - attributes: new List> + attributes: new List { - new KeyValuePair("class", factory.Markup("btn")) + new TagHelperAttributeNode("class", factory.Markup("btn")) })), availableDescriptorsColon }, @@ -2382,9 +2383,9 @@ public static TheoryData PrefixedTagHelperBoundData new MarkupTagHelperBlock( "PREFIXmyth", tagMode: TagMode.SelfClosing, - attributes: new List> + attributes: new List { - new KeyValuePair("class", factory.Markup("btn")) + new TagHelperAttributeNode("class", factory.Markup("btn")) })), availableDescriptorsText }, @@ -2394,9 +2395,9 @@ public static TheoryData PrefixedTagHelperBoundData new MarkupTagHelperBlock( "th:myth2", tagMode: TagMode.SelfClosing, - attributes: new List> + attributes: new List { - new KeyValuePair("class", factory.Markup("btn")) + new TagHelperAttributeNode("class", factory.Markup("btn")) })), availableDescriptorsColon }, @@ -2406,9 +2407,9 @@ public static TheoryData PrefixedTagHelperBoundData new MarkupTagHelperBlock( "PREFIXmyth2", tagMode: TagMode.SelfClosing, - attributes: new List> + attributes: new List { - new KeyValuePair("class", factory.Markup("btn")) + new TagHelperAttributeNode("class", factory.Markup("btn")) })), availableDescriptorsText }, @@ -2417,9 +2418,9 @@ public static TheoryData PrefixedTagHelperBoundData new MarkupBlock( new MarkupTagHelperBlock( "th:myth", - attributes: new List> + attributes: new List { - new KeyValuePair("class", factory.Markup("btn")) + new TagHelperAttributeNode("class", factory.Markup("btn")) }, children: factory.Markup("words and spaces"))), availableDescriptorsColon @@ -2429,9 +2430,9 @@ public static TheoryData PrefixedTagHelperBoundData new MarkupBlock( new MarkupTagHelperBlock( "PREFIXmyth", - attributes: new List> + attributes: new List { - new KeyValuePair("class", factory.Markup("btn")) + new TagHelperAttributeNode("class", factory.Markup("btn")) }, children: factory.Markup("words and spaces"))), availableDescriptorsText @@ -2442,10 +2443,10 @@ public static TheoryData PrefixedTagHelperBoundData new MarkupTagHelperBlock( "th:myth2", tagMode: TagMode.SelfClosing, - attributes: new List> + attributes: new List { { - new KeyValuePair( + new TagHelperAttributeNode( "bound", new MarkupBlock( new MarkupBlock( @@ -2464,10 +2465,10 @@ public static TheoryData PrefixedTagHelperBoundData new MarkupTagHelperBlock( "PREFIXmyth2", tagMode: TagMode.SelfClosing, - attributes: new List> + attributes: new List { { - new KeyValuePair( + new TagHelperAttributeNode( "bound", new MarkupBlock( new MarkupBlock( @@ -2486,10 +2487,10 @@ public static TheoryData PrefixedTagHelperBoundData new MarkupTagHelperBlock( "PREFIXmyth2", tagMode: TagMode.SelfClosing, - attributes: new List> + attributes: new List { { - new KeyValuePair( + new TagHelperAttributeNode( "bound", new MarkupBlock( new MarkupBlock( diff --git a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/AttributeTargetingTagHelpers.cs b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/AttributeTargetingTagHelpers.cs index b21ac1d99..50774acac 100644 --- a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/AttributeTargetingTagHelpers.cs +++ b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/AttributeTargetingTagHelpers.cs @@ -14,9 +14,9 @@ public class AttributeTargetingTagHelpers private global::Microsoft.AspNetCore.Razor.Runtime.TagHelperRunner __tagHelperRunner = null; private global::Microsoft.AspNetCore.Razor.Runtime.TagHelperScopeManager __tagHelperScopeManager = null; private global::TestNamespace.PTagHelper __TestNamespace_PTagHelper = null; - private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("class", new global::Microsoft.AspNetCore.Html.HtmlString("btn")); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("class", new global::Microsoft.AspNetCore.Html.HtmlString("btn"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); private global::TestNamespace.CatchAllTagHelper __TestNamespace_CatchAllTagHelper = null; - private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_1 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("catchAll", new global::Microsoft.AspNetCore.Html.HtmlString("hi")); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_1 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("catchAll", new global::Microsoft.AspNetCore.Html.HtmlString("hi"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); private global::TestNamespace.InputTagHelper __TestNamespace_InputTagHelper = null; private global::TestNamespace.InputTagHelper2 __TestNamespace_InputTagHelper2 = null; #line hidden @@ -65,14 +65,14 @@ public override async Task ExecuteAsync() __TestNamespace_InputTagHelper2 = CreateTagHelper(); __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper2); __TestNamespace_InputTagHelper.Type = "checkbox"; - __tagHelperExecutionContext.AddTagHelperAttribute("type", __TestNamespace_InputTagHelper.Type); + __tagHelperExecutionContext.AddTagHelperAttribute("type", __TestNamespace_InputTagHelper.Type, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __TestNamespace_InputTagHelper2.Type = __TestNamespace_InputTagHelper.Type; #line 6 "AttributeTargetingTagHelpers.cshtml" __TestNamespace_InputTagHelper2.Checked = true; #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper2.Checked); + __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper2.Checked, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(152, 40, false); Write(__tagHelperExecutionContext.Output); @@ -91,14 +91,14 @@ public override async Task ExecuteAsync() __TestNamespace_CatchAllTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__TestNamespace_CatchAllTagHelper); __TestNamespace_InputTagHelper.Type = "checkbox"; - __tagHelperExecutionContext.AddTagHelperAttribute("type", __TestNamespace_InputTagHelper.Type); + __tagHelperExecutionContext.AddTagHelperAttribute("type", __TestNamespace_InputTagHelper.Type, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __TestNamespace_InputTagHelper2.Type = __TestNamespace_InputTagHelper.Type; #line 7 "AttributeTargetingTagHelpers.cshtml" __TestNamespace_InputTagHelper2.Checked = true; #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper2.Checked); + __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper2.Checked, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_1); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(198, 54, false); diff --git a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.CustomAttributeCodeGenerator.cs b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.CustomAttributeCodeGenerator.cs index 28dcbabb2..6a49042e1 100644 --- a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.CustomAttributeCodeGenerator.cs +++ b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.CustomAttributeCodeGenerator.cs @@ -13,9 +13,9 @@ public class BasicTagHelpers private global::Microsoft.AspNetCore.Razor.Runtime.TagHelperRunner __tagHelperRunner = null; private global::Microsoft.AspNetCore.Razor.Runtime.TagHelperScopeManager __tagHelperScopeManager = null; private global::TestNamespace.PTagHelper __TestNamespace_PTagHelper = null; - private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("class", new global::Microsoft.AspNetCore.Html.HtmlString("Hello World")); - private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_1 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("data-delay", new global::Microsoft.AspNetCore.Html.HtmlString("1000")); - private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_2 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("data", new global::Microsoft.AspNetCore.Html.HtmlString("-delay1000")); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("class", new global::Microsoft.AspNetCore.Html.HtmlString("Hello World"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_1 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("data-delay", new global::Microsoft.AspNetCore.Html.HtmlString("1000"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_2 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("data", new global::Microsoft.AspNetCore.Html.HtmlString("-delay1000"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); private global::TestNamespace.InputTagHelper __TestNamespace_InputTagHelper = null; private global::TestNamespace.InputTagHelper2 __TestNamespace_InputTagHelper2 = null; #line hidden @@ -65,9 +65,9 @@ public override async Task ExecuteAsync() #line hidden WriteLiteral(" + 1"); __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); - __tagHelperExecutionContext.AddHtmlAttribute("data-interval", Html.Raw(__tagHelperStringValueBuffer)); + __tagHelperExecutionContext.AddHtmlAttribute("data-interval", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __TestNamespace_InputTagHelper.Type = **From custom attribute code renderer**: "text"; - __tagHelperExecutionContext.AddTagHelperAttribute("type", __TestNamespace_InputTagHelper.Type); + __tagHelperExecutionContext.AddTagHelperAttribute("type", __TestNamespace_InputTagHelper.Type, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __TestNamespace_InputTagHelper2.Type = __TestNamespace_InputTagHelper.Type; await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(190, 71, false); @@ -85,14 +85,14 @@ public override async Task ExecuteAsync() __TestNamespace_InputTagHelper2 = CreateTagHelper(); __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper2); __TestNamespace_InputTagHelper.Type = **From custom attribute code renderer**: "checkbox"; - __tagHelperExecutionContext.AddTagHelperAttribute("type", __TestNamespace_InputTagHelper.Type); + __tagHelperExecutionContext.AddTagHelperAttribute("type", __TestNamespace_InputTagHelper.Type, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __TestNamespace_InputTagHelper2.Type = __TestNamespace_InputTagHelper.Type; #line 7 "BasicTagHelpers.cshtml" __TestNamespace_InputTagHelper2.Checked = **From custom attribute code renderer**: true; #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper2.Checked); + __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper2.Checked, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(271, 39, false); Write(__tagHelperExecutionContext.Output); diff --git a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.Prefixed.cs b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.Prefixed.cs index ee30f8d74..88b238ef9 100644 --- a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.Prefixed.cs +++ b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.Prefixed.cs @@ -14,7 +14,7 @@ public class BasicTagHelpers.Prefixed private global::Microsoft.AspNetCore.Razor.Runtime.TagHelperRunner __tagHelperRunner = null; private global::Microsoft.AspNetCore.Razor.Runtime.TagHelperScopeManager __tagHelperScopeManager = null; private global::TestNamespace.PTagHelper __TestNamespace_PTagHelper = null; - private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("class", new global::Microsoft.AspNetCore.Html.HtmlString("Hello World")); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("class", new global::Microsoft.AspNetCore.Html.HtmlString("Hello World"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); private global::TestNamespace.InputTagHelper __TestNamespace_InputTagHelper = null; private global::TestNamespace.InputTagHelper2 __TestNamespace_InputTagHelper2 = null; #line hidden @@ -42,14 +42,14 @@ public override async Task ExecuteAsync() __TestNamespace_InputTagHelper2 = CreateTagHelper(); __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper2); __TestNamespace_InputTagHelper.Type = "checkbox"; - __tagHelperExecutionContext.AddTagHelperAttribute("type", __TestNamespace_InputTagHelper.Type); + __tagHelperExecutionContext.AddTagHelperAttribute("type", __TestNamespace_InputTagHelper.Type, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __TestNamespace_InputTagHelper2.Type = __TestNamespace_InputTagHelper.Type; #line 8 "BasicTagHelpers.Prefixed.cshtml" __TestNamespace_InputTagHelper2.Checked = true; #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper2.Checked); + __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper2.Checked, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(189, 41, false); Write(__tagHelperExecutionContext.Output); diff --git a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.cs b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.cs index bd82fcd1e..e5e36b971 100644 --- a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.cs +++ b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.cs @@ -14,9 +14,9 @@ public class BasicTagHelpers private global::Microsoft.AspNetCore.Razor.Runtime.TagHelperRunner __tagHelperRunner = null; private global::Microsoft.AspNetCore.Razor.Runtime.TagHelperScopeManager __tagHelperScopeManager = null; private global::TestNamespace.PTagHelper __TestNamespace_PTagHelper = null; - private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("class", new global::Microsoft.AspNetCore.Html.HtmlString("Hello World")); - private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_1 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("data-delay", new global::Microsoft.AspNetCore.Html.HtmlString("1000")); - private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_2 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("data", new global::Microsoft.AspNetCore.Html.HtmlString("-delay1000")); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("class", new global::Microsoft.AspNetCore.Html.HtmlString("Hello World"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_1 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("data-delay", new global::Microsoft.AspNetCore.Html.HtmlString("1000"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_2 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("data", new global::Microsoft.AspNetCore.Html.HtmlString("-delay1000"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); private global::TestNamespace.InputTagHelper __TestNamespace_InputTagHelper = null; private global::TestNamespace.InputTagHelper2 __TestNamespace_InputTagHelper2 = null; #line hidden @@ -66,9 +66,9 @@ public override async Task ExecuteAsync() #line hidden WriteLiteral(" + 1"); __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); - __tagHelperExecutionContext.AddHtmlAttribute("data-interval", Html.Raw(__tagHelperStringValueBuffer)); + __tagHelperExecutionContext.AddHtmlAttribute("data-interval", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __TestNamespace_InputTagHelper.Type = "text"; - __tagHelperExecutionContext.AddTagHelperAttribute("type", __TestNamespace_InputTagHelper.Type); + __tagHelperExecutionContext.AddTagHelperAttribute("type", __TestNamespace_InputTagHelper.Type, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __TestNamespace_InputTagHelper2.Type = __TestNamespace_InputTagHelper.Type; await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(190, 71, false); @@ -86,14 +86,14 @@ public override async Task ExecuteAsync() __TestNamespace_InputTagHelper2 = CreateTagHelper(); __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper2); __TestNamespace_InputTagHelper.Type = "checkbox"; - __tagHelperExecutionContext.AddTagHelperAttribute("type", __TestNamespace_InputTagHelper.Type); + __tagHelperExecutionContext.AddTagHelperAttribute("type", __TestNamespace_InputTagHelper.Type, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __TestNamespace_InputTagHelper2.Type = __TestNamespace_InputTagHelper.Type; #line 7 "BasicTagHelpers.cshtml" __TestNamespace_InputTagHelper2.Checked = true; #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper2.Checked); + __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper2.Checked, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(271, 39, false); Write(__tagHelperExecutionContext.Output); diff --git a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/ComplexTagHelpers.cs b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/ComplexTagHelpers.cs index 67b5bccbd..92f15faf3 100644 --- a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/ComplexTagHelpers.cs +++ b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/ComplexTagHelpers.cs @@ -16,13 +16,13 @@ public class ComplexTagHelpers private global::TestNamespace.PTagHelper __TestNamespace_PTagHelper = null; private global::TestNamespace.InputTagHelper __TestNamespace_InputTagHelper = null; private global::TestNamespace.InputTagHelper2 __TestNamespace_InputTagHelper2 = null; - private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("value", new global::Microsoft.AspNetCore.Html.HtmlString("")); - private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_1 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("placeholder", new global::Microsoft.AspNetCore.Html.HtmlString("Enter in a new time...")); - private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_2 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("unbound", new global::Microsoft.AspNetCore.Html.HtmlString("first value")); - private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_3 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("unbound", new global::Microsoft.AspNetCore.Html.HtmlString("second value")); - private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_4 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("unbound", new global::Microsoft.AspNetCore.Html.HtmlString("hello")); - private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_5 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("unbound", new global::Microsoft.AspNetCore.Html.HtmlString("world")); - private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_6 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("class", new global::Microsoft.AspNetCore.Html.HtmlString("hello")); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("value", new global::Microsoft.AspNetCore.Html.HtmlString(""), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_1 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("placeholder", new global::Microsoft.AspNetCore.Html.HtmlString("Enter in a new time..."), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_2 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("unbound", new global::Microsoft.AspNetCore.Html.HtmlString("first value"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_3 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("unbound", new global::Microsoft.AspNetCore.Html.HtmlString("second value"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_4 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("unbound", new global::Microsoft.AspNetCore.Html.HtmlString("hello"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_5 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("unbound", new global::Microsoft.AspNetCore.Html.HtmlString("world"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_6 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("class", new global::Microsoft.AspNetCore.Html.HtmlString("hello"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); #line hidden public ComplexTagHelpers() { @@ -80,7 +80,7 @@ public override async Task ExecuteAsync() __TestNamespace_InputTagHelper2 = CreateTagHelper(); __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper2); __TestNamespace_InputTagHelper.Type = "text"; - __tagHelperExecutionContext.AddTagHelperAttribute("type", __TestNamespace_InputTagHelper.Type); + __tagHelperExecutionContext.AddTagHelperAttribute("type", __TestNamespace_InputTagHelper.Type, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __TestNamespace_InputTagHelper2.Type = __TestNamespace_InputTagHelper.Type; __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_0); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_1); @@ -135,14 +135,14 @@ public override async Task ExecuteAsync() #line hidden __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); __TestNamespace_InputTagHelper.Type = __tagHelperStringValueBuffer; - __tagHelperExecutionContext.AddTagHelperAttribute("type", __TestNamespace_InputTagHelper.Type); + __tagHelperExecutionContext.AddTagHelperAttribute("type", __TestNamespace_InputTagHelper.Type, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __TestNamespace_InputTagHelper2.Type = __TestNamespace_InputTagHelper.Type; #line 16 "ComplexTagHelpers.cshtml" __TestNamespace_InputTagHelper2.Checked = true; #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper2.Checked); + __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper2.Checked, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(431, 37, false); Write(__tagHelperExecutionContext.Output); @@ -179,7 +179,7 @@ public override async Task ExecuteAsync() #line hidden __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); __TestNamespace_InputTagHelper.Type = __tagHelperStringValueBuffer; - __tagHelperExecutionContext.AddTagHelperAttribute("tYPe", __TestNamespace_InputTagHelper.Type); + __tagHelperExecutionContext.AddTagHelperAttribute("tYPe", __TestNamespace_InputTagHelper.Type, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.SingleQuotes); __TestNamespace_InputTagHelper2.Type = __TestNamespace_InputTagHelper.Type; await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(490, 50, false); @@ -219,7 +219,7 @@ public override async Task ExecuteAsync() __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); __TestNamespace_InputTagHelper.Type = __tagHelperStringValueBuffer; - __tagHelperExecutionContext.AddTagHelperAttribute("type", __TestNamespace_InputTagHelper.Type); + __tagHelperExecutionContext.AddTagHelperAttribute("type", __TestNamespace_InputTagHelper.Type, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.SingleQuotes); __TestNamespace_InputTagHelper2.Type = __TestNamespace_InputTagHelper.Type; await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(558, 79, false); @@ -242,7 +242,7 @@ public override async Task ExecuteAsync() ); __TestNamespace_PTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__TestNamespace_PTagHelper); - BeginAddHtmlAttributeValues(__tagHelperExecutionContext, "time", 3); + BeginAddHtmlAttributeValues(__tagHelperExecutionContext, "time", 3, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); AddHtmlAttributeValue("", 146, "Current", 146, 7, true); AddHtmlAttributeValue(" ", 153, "Time:", 154, 6, true); #line 8 "ComplexTagHelpers.cshtml" @@ -294,7 +294,7 @@ public override async Task ExecuteAsync() #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("ChecKED", __TestNamespace_InputTagHelper2.Checked); + __tagHelperExecutionContext.AddTagHelperAttribute("ChecKED", __TestNamespace_InputTagHelper2.Checked, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(817, 28, false); Write(__tagHelperExecutionContext.Output); @@ -313,7 +313,7 @@ public override async Task ExecuteAsync() #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age); + __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_3); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) @@ -345,7 +345,7 @@ public override async Task ExecuteAsync() #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper2.Checked); + __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper2.Checked, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(925, 85, false); Write(__tagHelperExecutionContext.Output); @@ -363,7 +363,7 @@ public override async Task ExecuteAsync() #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age); + __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { @@ -392,7 +392,7 @@ public override async Task ExecuteAsync() #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper2.Checked); + __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper2.Checked, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(1088, 48, false); Write(__tagHelperExecutionContext.Output); @@ -410,7 +410,7 @@ public override async Task ExecuteAsync() #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age); + __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { @@ -439,7 +439,7 @@ public override async Task ExecuteAsync() #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper2.Checked); + __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper2.Checked, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(1216, 63, false); Write(__tagHelperExecutionContext.Output); @@ -457,7 +457,7 @@ public override async Task ExecuteAsync() #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age); + __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { @@ -486,7 +486,7 @@ public override async Task ExecuteAsync() #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper2.Checked); + __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper2.Checked, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(1343, 26, false); Write(__tagHelperExecutionContext.Output); @@ -501,7 +501,7 @@ public override async Task ExecuteAsync() #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age); + __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_6); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) diff --git a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/DuplicateAttributeTagHelpers.DesignTime.cs b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/DuplicateAttributeTagHelpers.DesignTime.cs index 2c51b12a5..2ccc2637c 100644 --- a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/DuplicateAttributeTagHelpers.DesignTime.cs +++ b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/DuplicateAttributeTagHelpers.DesignTime.cs @@ -36,6 +36,15 @@ public override async Task ExecuteAsync() #line 5 "DuplicateAttributeTagHelpers.cshtml" __TestNamespace_InputTagHelper2.Checked = true; +#line default +#line hidden + __TestNamespace_InputTagHelper = CreateTagHelper(); + __TestNamespace_InputTagHelper2 = CreateTagHelper(); + __TestNamespace_InputTagHelper.Type = "button"; + __TestNamespace_InputTagHelper2.Type = __TestNamespace_InputTagHelper.Type; +#line 6 "DuplicateAttributeTagHelpers.cshtml" +__TestNamespace_InputTagHelper2.Checked = true; + #line default #line hidden __TestNamespace_PTagHelper = CreateTagHelper(); diff --git a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/DuplicateAttributeTagHelpers.cs b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/DuplicateAttributeTagHelpers.cs index 9284bf7ee..17c5a352a 100644 --- a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/DuplicateAttributeTagHelpers.cs +++ b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/DuplicateAttributeTagHelpers.cs @@ -1,4 +1,4 @@ -#pragma checksum "DuplicateAttributeTagHelpers.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "84ecb9053de09ef4f2a69927fed3e41e188c730b" +#pragma checksum "DuplicateAttributeTagHelpers.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "b7cbc77774bfe558f4548cc5b3760f88754a329e" namespace TestOutput { using System; @@ -14,13 +14,15 @@ public class DuplicateAttributeTagHelpers private global::Microsoft.AspNetCore.Razor.Runtime.TagHelperRunner __tagHelperRunner = null; private global::Microsoft.AspNetCore.Razor.Runtime.TagHelperScopeManager __tagHelperScopeManager = null; private global::TestNamespace.PTagHelper __TestNamespace_PTagHelper = null; - private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("AGE", new global::Microsoft.AspNetCore.Html.HtmlString("40")); - private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_1 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("Age", new global::Microsoft.AspNetCore.Html.HtmlString("500")); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("AGE", new global::Microsoft.AspNetCore.Html.HtmlString("40"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_1 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("Age", new global::Microsoft.AspNetCore.Html.HtmlString("500"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); private global::TestNamespace.InputTagHelper __TestNamespace_InputTagHelper = null; private global::TestNamespace.InputTagHelper2 __TestNamespace_InputTagHelper2 = null; - private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_2 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("TYPE", new global::Microsoft.AspNetCore.Html.HtmlString("checkbox")); - private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_3 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("type", new global::Microsoft.AspNetCore.Html.HtmlString("checkbox")); - private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_4 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("checked", new global::Microsoft.AspNetCore.Html.HtmlString("false")); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_2 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("TYPE", new global::Microsoft.AspNetCore.Html.HtmlString("checkbox"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_3 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("type", new global::Microsoft.AspNetCore.Html.HtmlString("checkbox"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_4 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("checked", new global::Microsoft.AspNetCore.Html.HtmlString("false"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_5 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("checked", new global::Microsoft.AspNetCore.Html.HtmlString("true"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.SingleQuotes); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_6 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("checked", new global::Microsoft.AspNetCore.Html.HtmlString("true"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); #line hidden public DuplicateAttributeTagHelpers() { @@ -46,7 +48,7 @@ public override async Task ExecuteAsync() __TestNamespace_InputTagHelper2 = CreateTagHelper(); __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper2); __TestNamespace_InputTagHelper.Type = "button"; - __tagHelperExecutionContext.AddTagHelperAttribute("type", __TestNamespace_InputTagHelper.Type); + __tagHelperExecutionContext.AddTagHelperAttribute("type", __TestNamespace_InputTagHelper.Type, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __TestNamespace_InputTagHelper2.Type = __TestNamespace_InputTagHelper.Type; __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_2); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); @@ -65,14 +67,14 @@ public override async Task ExecuteAsync() __TestNamespace_InputTagHelper2 = CreateTagHelper(); __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper2); __TestNamespace_InputTagHelper.Type = "button"; - __tagHelperExecutionContext.AddTagHelperAttribute("type", __TestNamespace_InputTagHelper.Type); + __tagHelperExecutionContext.AddTagHelperAttribute("type", __TestNamespace_InputTagHelper.Type, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __TestNamespace_InputTagHelper2.Type = __TestNamespace_InputTagHelper.Type; #line 5 "DuplicateAttributeTagHelpers.cshtml" __TestNamespace_InputTagHelper2.Checked = true; #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper2.Checked); + __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper2.Checked, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_3); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_4); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); @@ -80,7 +82,35 @@ public override async Task ExecuteAsync() Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); - Instrumentation.BeginContext(184, 2, true); + Instrumentation.BeginContext(184, 6, true); + WriteLiteral("\r\n "); + Instrumentation.EndContext(); + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + } + ); + __TestNamespace_InputTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper); + __TestNamespace_InputTagHelper2 = CreateTagHelper(); + __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper2); + __TestNamespace_InputTagHelper.Type = "button"; + __tagHelperExecutionContext.AddTagHelperAttribute("type", __TestNamespace_InputTagHelper.Type, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.SingleQuotes); + __TestNamespace_InputTagHelper2.Type = __TestNamespace_InputTagHelper.Type; +#line 6 "DuplicateAttributeTagHelpers.cshtml" +__TestNamespace_InputTagHelper2.Checked = true; + +#line default +#line hidden + __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper2.Checked, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); + __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_3); + __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_5); + __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_3); + __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_6); + await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); + Instrumentation.BeginContext(190, 96, false); + Write(__tagHelperExecutionContext.Output); + Instrumentation.EndContext(); + __tagHelperExecutionContext = __tagHelperScopeManager.End(); + Instrumentation.BeginContext(286, 2, true); WriteLiteral("\r\n"); Instrumentation.EndContext(); } @@ -92,7 +122,7 @@ public override async Task ExecuteAsync() #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age); + __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_0); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_1); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); @@ -100,7 +130,7 @@ public override async Task ExecuteAsync() { await __tagHelperExecutionContext.SetOutputContentAsync(); } - Instrumentation.BeginContext(33, 157, false); + Instrumentation.BeginContext(33, 259, false); Write(__tagHelperExecutionContext.Output); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.End(); diff --git a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/DuplicateTargetTagHelper.cs b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/DuplicateTargetTagHelper.cs index 0cad9c1b2..194ed9a2c 100644 --- a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/DuplicateTargetTagHelper.cs +++ b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/DuplicateTargetTagHelper.cs @@ -36,14 +36,14 @@ public override async Task ExecuteAsync() __TestNamespace_CatchAllTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__TestNamespace_CatchAllTagHelper); __TestNamespace_InputTagHelper.Type = "checkbox"; - __tagHelperExecutionContext.AddTagHelperAttribute("type", __TestNamespace_InputTagHelper.Type); + __tagHelperExecutionContext.AddTagHelperAttribute("type", __TestNamespace_InputTagHelper.Type, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __TestNamespace_CatchAllTagHelper.Type = __TestNamespace_InputTagHelper.Type; #line 3 "DuplicateTargetTagHelper.cshtml" __TestNamespace_InputTagHelper.Checked = true; #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper.Checked); + __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper.Checked, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __TestNamespace_CatchAllTagHelper.Checked = __TestNamespace_InputTagHelper.Checked; await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(33, 40, false); diff --git a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/DynamicAttributeTagHelpers.cs b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/DynamicAttributeTagHelpers.cs index dc5c1ff87..61d21421e 100644 --- a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/DynamicAttributeTagHelpers.cs +++ b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/DynamicAttributeTagHelpers.cs @@ -32,7 +32,7 @@ public override async Task ExecuteAsync() ); __TestNamespace_InputTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper); - BeginAddHtmlAttributeValues(__tagHelperExecutionContext, "unbound", 2); + BeginAddHtmlAttributeValues(__tagHelperExecutionContext, "unbound", 2, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); AddHtmlAttributeValue("", 49, "prefix", 49, 6, true); #line 3 "DynamicAttributeTagHelpers.cshtml" AddHtmlAttributeValue(" ", 55, DateTime.Now, 56, 14, false); @@ -53,7 +53,7 @@ public override async Task ExecuteAsync() ); __TestNamespace_InputTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper); - BeginAddHtmlAttributeValues(__tagHelperExecutionContext, "unbound", 2); + BeginAddHtmlAttributeValues(__tagHelperExecutionContext, "unbound", 2, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); AddHtmlAttributeValue("", 93, new Template(async(__razor_attribute_value_writer) => { #line 5 "DynamicAttributeTagHelpers.cshtml" if (true) { @@ -114,8 +114,8 @@ public override async Task ExecuteAsync() WriteLiteral(" suffix"); __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); __TestNamespace_InputTagHelper.Bound = __tagHelperStringValueBuffer; - __tagHelperExecutionContext.AddTagHelperAttribute("bound", __TestNamespace_InputTagHelper.Bound); - BeginAddHtmlAttributeValues(__tagHelperExecutionContext, "unbound", 3); + __tagHelperExecutionContext.AddTagHelperAttribute("bound", __TestNamespace_InputTagHelper.Bound, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); + BeginAddHtmlAttributeValues(__tagHelperExecutionContext, "unbound", 3, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); AddHtmlAttributeValue("", 204, "prefix", 204, 6, true); #line 7 "DynamicAttributeTagHelpers.cshtml" AddHtmlAttributeValue(" ", 210, DateTime.Now, 211, 14, false); @@ -180,8 +180,8 @@ public override async Task ExecuteAsync() #line hidden __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); __TestNamespace_InputTagHelper.Bound = __tagHelperStringValueBuffer; - __tagHelperExecutionContext.AddTagHelperAttribute("bound", __TestNamespace_InputTagHelper.Bound); - BeginAddHtmlAttributeValues(__tagHelperExecutionContext, "unbound", 3); + __tagHelperExecutionContext.AddTagHelperAttribute("bound", __TestNamespace_InputTagHelper.Bound, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); + BeginAddHtmlAttributeValues(__tagHelperExecutionContext, "unbound", 3, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); #line 10 "DynamicAttributeTagHelpers.cshtml" AddHtmlAttributeValue("", 345, long.MinValue, 345, 14, false); @@ -241,7 +241,7 @@ public override async Task ExecuteAsync() ); __TestNamespace_InputTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper); - BeginAddHtmlAttributeValues(__tagHelperExecutionContext, "unbound", 5); + BeginAddHtmlAttributeValues(__tagHelperExecutionContext, "unbound", 5, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); #line 12 "DynamicAttributeTagHelpers.cshtml" AddHtmlAttributeValue("", 442, long.MinValue, 442, 14, false); @@ -273,7 +273,7 @@ public override async Task ExecuteAsync() ); __TestNamespace_InputTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper); - BeginAddHtmlAttributeValues(__tagHelperExecutionContext, "unbound", 1); + BeginAddHtmlAttributeValues(__tagHelperExecutionContext, "unbound", 1, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); AddHtmlAttributeValue("", 526, new Template(async(__razor_attribute_value_writer) => { #line 14 "DynamicAttributeTagHelpers.cshtml" if (true) { diff --git a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/EmptyAttributeTagHelpers.cs b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/EmptyAttributeTagHelpers.cs index 521f1fe68..671bedf25 100644 --- a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/EmptyAttributeTagHelpers.cs +++ b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/EmptyAttributeTagHelpers.cs @@ -15,7 +15,7 @@ public class EmptyAttributeTagHelpers private global::Microsoft.AspNetCore.Razor.Runtime.TagHelperScopeManager __tagHelperScopeManager = null; private global::TestNamespace.InputTagHelper __TestNamespace_InputTagHelper = null; private global::TestNamespace.InputTagHelper2 __TestNamespace_InputTagHelper2 = null; - private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("class", new global::Microsoft.AspNetCore.Html.HtmlString("")); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("class", new global::Microsoft.AspNetCore.Html.HtmlString(""), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); private global::TestNamespace.PTagHelper __TestNamespace_PTagHelper = null; #line hidden public EmptyAttributeTagHelpers() @@ -38,14 +38,14 @@ public override async Task ExecuteAsync() __TestNamespace_InputTagHelper2 = CreateTagHelper(); __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper2); __TestNamespace_InputTagHelper.Type = ""; - __tagHelperExecutionContext.AddTagHelperAttribute("type", __TestNamespace_InputTagHelper.Type); + __tagHelperExecutionContext.AddTagHelperAttribute("type", __TestNamespace_InputTagHelper.Type, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __TestNamespace_InputTagHelper2.Type = __TestNamespace_InputTagHelper.Type; #line 4 "EmptyAttributeTagHelpers.cshtml" __TestNamespace_InputTagHelper2.Checked = ; #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper2.Checked); + __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper2.Checked, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_0); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(38, 34, false); @@ -67,14 +67,14 @@ public override async Task ExecuteAsync() __TestNamespace_InputTagHelper2 = CreateTagHelper(); __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper2); __TestNamespace_InputTagHelper.Type = ""; - __tagHelperExecutionContext.AddTagHelperAttribute("type", __TestNamespace_InputTagHelper.Type); + __tagHelperExecutionContext.AddTagHelperAttribute("type", __TestNamespace_InputTagHelper.Type, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __TestNamespace_InputTagHelper2.Type = __TestNamespace_InputTagHelper.Type; #line 6 "EmptyAttributeTagHelpers.cshtml" __TestNamespace_InputTagHelper2.Checked = ; #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper2.Checked); + __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper2.Checked, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_0); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(98, 34, false); @@ -93,7 +93,7 @@ public override async Task ExecuteAsync() #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age); + __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.SingleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { diff --git a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/EnumTagHelpers.cs b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/EnumTagHelpers.cs index bbab61964..c4432b399 100644 --- a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/EnumTagHelpers.cs +++ b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/EnumTagHelpers.cs @@ -50,7 +50,7 @@ public override async Task ExecuteAsync() #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("value", __TestNamespace_InputTagHelper.Value); + __tagHelperExecutionContext.AddTagHelperAttribute("value", __TestNamespace_InputTagHelper.Value, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(79, 33, false); Write(__tagHelperExecutionContext.Output); @@ -66,7 +66,7 @@ public override async Task ExecuteAsync() __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper); __TestNamespace_CatchAllTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__TestNamespace_CatchAllTagHelper); - BeginAddHtmlAttributeValues(__tagHelperExecutionContext, "class", 1); + BeginAddHtmlAttributeValues(__tagHelperExecutionContext, "class", 1, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); #line 8 "EnumTagHelpers.cshtml" AddHtmlAttributeValue("", 128, MyEnum.MySecondValue, 128, 21, false); @@ -93,7 +93,7 @@ public override async Task ExecuteAsync() #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("value", __TestNamespace_InputTagHelper.Value); + __tagHelperExecutionContext.AddTagHelperAttribute("value", __TestNamespace_InputTagHelper.Value, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(155, 25, false); Write(__tagHelperExecutionContext.Output); @@ -114,13 +114,13 @@ public override async Task ExecuteAsync() #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("value", __TestNamespace_InputTagHelper.Value); + __tagHelperExecutionContext.AddTagHelperAttribute("value", __TestNamespace_InputTagHelper.Value, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); #line 10 "EnumTagHelpers.cshtml" __TestNamespace_CatchAllTagHelper.CatchAll = global::Microsoft.AspNetCore.Razor.Test.Generator.MyEnum.MyValue; #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("catch-all", __TestNamespace_CatchAllTagHelper.CatchAll); + __tagHelperExecutionContext.AddTagHelperAttribute("catch-all", __TestNamespace_CatchAllTagHelper.CatchAll, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(182, 50, false); Write(__tagHelperExecutionContext.Output); @@ -141,13 +141,13 @@ public override async Task ExecuteAsync() #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("value", __TestNamespace_InputTagHelper.Value); + __tagHelperExecutionContext.AddTagHelperAttribute("value", __TestNamespace_InputTagHelper.Value, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); #line 11 "EnumTagHelpers.cshtml" __TestNamespace_CatchAllTagHelper.CatchAll = enumValue; #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("catch-all", __TestNamespace_CatchAllTagHelper.CatchAll); + __tagHelperExecutionContext.AddTagHelperAttribute("catch-all", __TestNamespace_CatchAllTagHelper.CatchAll, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(234, 51, false); Write(__tagHelperExecutionContext.Output); diff --git a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/EscapedTagHelpers.cs b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/EscapedTagHelpers.cs index 715f9e644..24cae06ea 100644 --- a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/EscapedTagHelpers.cs +++ b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/EscapedTagHelpers.cs @@ -53,14 +53,14 @@ public override async Task ExecuteAsync() #line hidden __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); __TestNamespace_InputTagHelper.Type = __tagHelperStringValueBuffer; - __tagHelperExecutionContext.AddTagHelperAttribute("type", __TestNamespace_InputTagHelper.Type); + __tagHelperExecutionContext.AddTagHelperAttribute("type", __TestNamespace_InputTagHelper.Type, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __TestNamespace_InputTagHelper2.Type = __TestNamespace_InputTagHelper.Type; #line 6 "EscapedTagHelpers.cshtml" __TestNamespace_InputTagHelper2.Checked = true; #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper2.Checked); + __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper2.Checked, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(184, 45, false); Write(__tagHelperExecutionContext.Output); diff --git a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/IncompleteTagHelper.cs b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/IncompleteTagHelper.cs index c3e9d70b8..6e8233961 100644 --- a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/IncompleteTagHelper.cs +++ b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/IncompleteTagHelper.cs @@ -14,7 +14,7 @@ public class IncompleteTagHelper private global::Microsoft.AspNetCore.Razor.Runtime.TagHelperRunner __tagHelperRunner = null; private global::Microsoft.AspNetCore.Razor.Runtime.TagHelperScopeManager __tagHelperScopeManager = null; private global::TestNamespace.PTagHelper __TestNamespace_PTagHelper = null; - private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("class", new global::Microsoft.AspNetCore.Html.HtmlString("")); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("class", new global::Microsoft.AspNetCore.Html.HtmlString(""), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); #line hidden public IncompleteTagHelper() { diff --git a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/MinimizedTagHelpers.cs b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/MinimizedTagHelpers.cs index 9120b52e9..92b389b9a 100644 --- a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/MinimizedTagHelpers.cs +++ b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/MinimizedTagHelpers.cs @@ -15,11 +15,11 @@ public class MinimizedTagHelpers private global::Microsoft.AspNetCore.Razor.Runtime.TagHelperScopeManager __tagHelperScopeManager = null; private global::TestNamespace.CatchAllTagHelper __TestNamespace_CatchAllTagHelper = null; private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("catchall-unbound-required"); - private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_1 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("class", new global::Microsoft.AspNetCore.Html.HtmlString("btn")); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_1 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("class", new global::Microsoft.AspNetCore.Html.HtmlString("btn"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); private global::TestNamespace.InputTagHelper __TestNamespace_InputTagHelper = null; private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_2 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("input-unbound-required"); - private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_3 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("catchall-unbound-required", new global::Microsoft.AspNetCore.Html.HtmlString("hello")); - private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_4 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("input-unbound-required", new global::Microsoft.AspNetCore.Html.HtmlString("hello2")); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_3 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("catchall-unbound-required", new global::Microsoft.AspNetCore.Html.HtmlString("hello"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_4 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("input-unbound-required", new global::Microsoft.AspNetCore.Html.HtmlString("hello2"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); #line hidden public MinimizedTagHelpers() { @@ -63,7 +63,7 @@ public override async Task ExecuteAsync() __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_0); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_2); __TestNamespace_InputTagHelper.BoundRequiredString = "hello"; - __tagHelperExecutionContext.AddTagHelperAttribute("input-bound-required-string", __TestNamespace_InputTagHelper.BoundRequiredString); + __tagHelperExecutionContext.AddTagHelperAttribute("input-bound-required-string", __TestNamespace_InputTagHelper.BoundRequiredString, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(161, 119, false); Write(__tagHelperExecutionContext.Output); @@ -83,9 +83,9 @@ public override async Task ExecuteAsync() __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_0); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_2); __TestNamespace_CatchAllTagHelper.BoundRequiredString = "world"; - __tagHelperExecutionContext.AddTagHelperAttribute("catchall-bound-string", __TestNamespace_CatchAllTagHelper.BoundRequiredString); + __tagHelperExecutionContext.AddTagHelperAttribute("catchall-bound-string", __TestNamespace_CatchAllTagHelper.BoundRequiredString, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __TestNamespace_InputTagHelper.BoundRequiredString = "hello2"; - __tagHelperExecutionContext.AddTagHelperAttribute("input-bound-required-string", __TestNamespace_InputTagHelper.BoundRequiredString); + __tagHelperExecutionContext.AddTagHelperAttribute("input-bound-required-string", __TestNamespace_InputTagHelper.BoundRequiredString, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(286, 176, false); Write(__tagHelperExecutionContext.Output); @@ -106,7 +106,7 @@ public override async Task ExecuteAsync() __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_4); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_0); __TestNamespace_InputTagHelper.BoundRequiredString = "world"; - __tagHelperExecutionContext.AddTagHelperAttribute("input-bound-required-string", __TestNamespace_InputTagHelper.BoundRequiredString); + __tagHelperExecutionContext.AddTagHelperAttribute("input-bound-required-string", __TestNamespace_InputTagHelper.BoundRequiredString, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(468, 206, false); Write(__tagHelperExecutionContext.Output); diff --git a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/NestedScriptTagTagHelpers.cs b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/NestedScriptTagTagHelpers.cs index 9c5e8392d..0c85a3750 100644 --- a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/NestedScriptTagTagHelpers.cs +++ b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/NestedScriptTagTagHelpers.cs @@ -14,8 +14,8 @@ public class NestedScriptTagTagHelpers private global::Microsoft.AspNetCore.Razor.Runtime.TagHelperRunner __tagHelperRunner = null; private global::Microsoft.AspNetCore.Razor.Runtime.TagHelperScopeManager __tagHelperScopeManager = null; private global::TestNamespace.PTagHelper __TestNamespace_PTagHelper = null; - private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("class", new global::Microsoft.AspNetCore.Html.HtmlString("Hello World")); - private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_1 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("data-delay", new global::Microsoft.AspNetCore.Html.HtmlString("1000")); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("class", new global::Microsoft.AspNetCore.Html.HtmlString("Hello World"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_1 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("data-delay", new global::Microsoft.AspNetCore.Html.HtmlString("1000"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); private global::TestNamespace.InputTagHelper __TestNamespace_InputTagHelper = null; private global::TestNamespace.InputTagHelper2 __TestNamespace_InputTagHelper2 = null; #line hidden @@ -66,16 +66,16 @@ public override async Task ExecuteAsync() #line hidden WriteLiteral(" + 1"); __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); - __tagHelperExecutionContext.AddHtmlAttribute("data-interval", Html.Raw(__tagHelperStringValueBuffer)); + __tagHelperExecutionContext.AddHtmlAttribute("data-interval", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __TestNamespace_InputTagHelper.Type = "text"; - __tagHelperExecutionContext.AddTagHelperAttribute("type", __TestNamespace_InputTagHelper.Type); + __tagHelperExecutionContext.AddTagHelperAttribute("type", __TestNamespace_InputTagHelper.Type, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __TestNamespace_InputTagHelper2.Type = __TestNamespace_InputTagHelper.Type; #line 8 "NestedScriptTagTagHelpers.cshtml" __TestNamespace_InputTagHelper2.Checked = true; #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper2.Checked); + __tagHelperExecutionContext.AddTagHelperAttribute("checked", __TestNamespace_InputTagHelper2.Checked, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(307, 86, false); Write(__tagHelperExecutionContext.Output); diff --git a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/PrefixedAttributeTagHelpers.Reversed.cs b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/PrefixedAttributeTagHelpers.Reversed.cs index cb5043967..2b5be55a1 100644 --- a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/PrefixedAttributeTagHelpers.Reversed.cs +++ b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/PrefixedAttributeTagHelpers.Reversed.cs @@ -15,10 +15,10 @@ public class PrefixedAttributeTagHelpers private global::Microsoft.AspNetCore.Razor.Runtime.TagHelperScopeManager __tagHelperScopeManager = null; private global::TestNamespace.InputTagHelper2 __TestNamespace_InputTagHelper2 = null; private global::TestNamespace.InputTagHelper1 __TestNamespace_InputTagHelper1 = null; - private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("type", new global::Microsoft.AspNetCore.Html.HtmlString("checkbox")); - private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_1 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("type", new global::Microsoft.AspNetCore.Html.HtmlString("password")); - private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_2 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("type", new global::Microsoft.AspNetCore.Html.HtmlString("radio")); - private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_3 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("int-prefix-salt", new global::Microsoft.AspNetCore.Html.HtmlString("8")); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("type", new global::Microsoft.AspNetCore.Html.HtmlString("checkbox"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_1 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("type", new global::Microsoft.AspNetCore.Html.HtmlString("password"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_2 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("type", new global::Microsoft.AspNetCore.Html.HtmlString("radio"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_3 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("int-prefix-salt", new global::Microsoft.AspNetCore.Html.HtmlString("8"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); #line hidden public PrefixedAttributeTagHelpers() { @@ -63,14 +63,14 @@ public override async Task ExecuteAsync() #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("int-dictionary", __TestNamespace_InputTagHelper2.IntDictionaryProperty); + __tagHelperExecutionContext.AddTagHelperAttribute("int-dictionary", __TestNamespace_InputTagHelper2.IntDictionaryProperty, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __TestNamespace_InputTagHelper1.IntDictionaryProperty = __TestNamespace_InputTagHelper2.IntDictionaryProperty; #line 16 "PrefixedAttributeTagHelpers.cshtml" __TestNamespace_InputTagHelper2.StringDictionaryProperty = stringDictionary; #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("string-dictionary", __TestNamespace_InputTagHelper2.StringDictionaryProperty); + __tagHelperExecutionContext.AddTagHelperAttribute("string-dictionary", __TestNamespace_InputTagHelper2.StringDictionaryProperty, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __TestNamespace_InputTagHelper1.StringDictionaryProperty = __TestNamespace_InputTagHelper2.StringDictionaryProperty; await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(329, 92, false); @@ -101,21 +101,21 @@ public override async Task ExecuteAsync() #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("int-dictionary", __TestNamespace_InputTagHelper2.IntDictionaryProperty); + __tagHelperExecutionContext.AddTagHelperAttribute("int-dictionary", __TestNamespace_InputTagHelper2.IntDictionaryProperty, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __TestNamespace_InputTagHelper1.IntDictionaryProperty = __TestNamespace_InputTagHelper2.IntDictionaryProperty; #line 17 "PrefixedAttributeTagHelpers.cshtml" __TestNamespace_InputTagHelper2.IntDictionaryProperty["garlic"] = 37; #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("int-prefix-garlic", __TestNamespace_InputTagHelper2.IntDictionaryProperty["garlic"]); + __tagHelperExecutionContext.AddTagHelperAttribute("int-prefix-garlic", __TestNamespace_InputTagHelper2.IntDictionaryProperty["garlic"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __TestNamespace_InputTagHelper1.IntDictionaryProperty["garlic"] = __TestNamespace_InputTagHelper2.IntDictionaryProperty["garlic"]; #line 17 "PrefixedAttributeTagHelpers.cshtml" __TestNamespace_InputTagHelper2.IntDictionaryProperty["grabber"] = 42; #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("int-prefix-grabber", __TestNamespace_InputTagHelper2.IntDictionaryProperty["grabber"]); + __tagHelperExecutionContext.AddTagHelperAttribute("int-prefix-grabber", __TestNamespace_InputTagHelper2.IntDictionaryProperty["grabber"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __TestNamespace_InputTagHelper1.IntProperty = __TestNamespace_InputTagHelper2.IntDictionaryProperty["grabber"]; await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(427, 103, false); @@ -154,28 +154,28 @@ public override async Task ExecuteAsync() #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("int-prefix-grabber", __TestNamespace_InputTagHelper2.IntDictionaryProperty["grabber"]); + __tagHelperExecutionContext.AddTagHelperAttribute("int-prefix-grabber", __TestNamespace_InputTagHelper2.IntDictionaryProperty["grabber"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __TestNamespace_InputTagHelper1.IntProperty = __TestNamespace_InputTagHelper2.IntDictionaryProperty["grabber"]; #line 19 "PrefixedAttributeTagHelpers.cshtml" __TestNamespace_InputTagHelper2.IntDictionaryProperty["salt"] = 37; #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("int-prefix-salt", __TestNamespace_InputTagHelper2.IntDictionaryProperty["salt"]); + __tagHelperExecutionContext.AddTagHelperAttribute("int-prefix-salt", __TestNamespace_InputTagHelper2.IntDictionaryProperty["salt"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __TestNamespace_InputTagHelper1.IntDictionaryProperty["salt"] = __TestNamespace_InputTagHelper2.IntDictionaryProperty["salt"]; #line 19 "PrefixedAttributeTagHelpers.cshtml" __TestNamespace_InputTagHelper2.IntDictionaryProperty["pepper"] = 98; #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("int-prefix-pepper", __TestNamespace_InputTagHelper2.IntDictionaryProperty["pepper"]); + __tagHelperExecutionContext.AddTagHelperAttribute("int-prefix-pepper", __TestNamespace_InputTagHelper2.IntDictionaryProperty["pepper"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __TestNamespace_InputTagHelper1.IntDictionaryProperty["pepper"] = __TestNamespace_InputTagHelper2.IntDictionaryProperty["pepper"]; __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_3); __TestNamespace_InputTagHelper2.StringDictionaryProperty["grabber"] = "string"; - __tagHelperExecutionContext.AddTagHelperAttribute("string-prefix-grabber", __TestNamespace_InputTagHelper2.StringDictionaryProperty["grabber"]); + __tagHelperExecutionContext.AddTagHelperAttribute("string-prefix-grabber", __TestNamespace_InputTagHelper2.StringDictionaryProperty["grabber"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __TestNamespace_InputTagHelper1.StringProperty = __TestNamespace_InputTagHelper2.StringDictionaryProperty["grabber"]; __TestNamespace_InputTagHelper2.StringDictionaryProperty["paprika"] = "another string"; - __tagHelperExecutionContext.AddTagHelperAttribute("string-prefix-paprika", __TestNamespace_InputTagHelper2.StringDictionaryProperty["paprika"]); + __tagHelperExecutionContext.AddTagHelperAttribute("string-prefix-paprika", __TestNamespace_InputTagHelper2.StringDictionaryProperty["paprika"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __TestNamespace_InputTagHelper1.StringDictionaryProperty["paprika"] = __TestNamespace_InputTagHelper2.StringDictionaryProperty["paprika"]; BeginWriteTagHelperAttribute(); WriteLiteral("literate "); @@ -187,7 +187,7 @@ public override async Task ExecuteAsync() WriteLiteral("?"); __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); __TestNamespace_InputTagHelper2.StringDictionaryProperty["cumin"] = __tagHelperStringValueBuffer; - __tagHelperExecutionContext.AddTagHelperAttribute("string-prefix-cumin", __TestNamespace_InputTagHelper2.StringDictionaryProperty["cumin"]); + __tagHelperExecutionContext.AddTagHelperAttribute("string-prefix-cumin", __TestNamespace_InputTagHelper2.StringDictionaryProperty["cumin"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __TestNamespace_InputTagHelper1.StringDictionaryProperty["cumin"] = __TestNamespace_InputTagHelper2.StringDictionaryProperty["cumin"]; await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(536, 257, false); @@ -225,10 +225,10 @@ public override async Task ExecuteAsync() #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("int-prefix-value", __TestNamespace_InputTagHelper2.IntDictionaryProperty["value"]); + __tagHelperExecutionContext.AddTagHelperAttribute("int-prefix-value", __TestNamespace_InputTagHelper2.IntDictionaryProperty["value"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __TestNamespace_InputTagHelper1.IntDictionaryProperty["value"] = __TestNamespace_InputTagHelper2.IntDictionaryProperty["value"]; __TestNamespace_InputTagHelper2.StringDictionaryProperty["thyme"] = "string"; - __tagHelperExecutionContext.AddTagHelperAttribute("string-prefix-thyme", __TestNamespace_InputTagHelper2.StringDictionaryProperty["thyme"]); + __tagHelperExecutionContext.AddTagHelperAttribute("string-prefix-thyme", __TestNamespace_InputTagHelper2.StringDictionaryProperty["thyme"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __TestNamespace_InputTagHelper1.StringDictionaryProperty["thyme"] = __TestNamespace_InputTagHelper2.StringDictionaryProperty["thyme"]; await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(799, 60, false); diff --git a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/PrefixedAttributeTagHelpers.cs b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/PrefixedAttributeTagHelpers.cs index 699152b6e..09f52b9b0 100644 --- a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/PrefixedAttributeTagHelpers.cs +++ b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/PrefixedAttributeTagHelpers.cs @@ -15,10 +15,10 @@ public class PrefixedAttributeTagHelpers private global::Microsoft.AspNetCore.Razor.Runtime.TagHelperScopeManager __tagHelperScopeManager = null; private global::TestNamespace.InputTagHelper1 __TestNamespace_InputTagHelper1 = null; private global::TestNamespace.InputTagHelper2 __TestNamespace_InputTagHelper2 = null; - private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("type", new global::Microsoft.AspNetCore.Html.HtmlString("checkbox")); - private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_1 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("type", new global::Microsoft.AspNetCore.Html.HtmlString("password")); - private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_2 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("type", new global::Microsoft.AspNetCore.Html.HtmlString("radio")); - private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_3 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("int-prefix-salt", new global::Microsoft.AspNetCore.Html.HtmlString("8")); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("type", new global::Microsoft.AspNetCore.Html.HtmlString("checkbox"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_1 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("type", new global::Microsoft.AspNetCore.Html.HtmlString("password"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_2 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("type", new global::Microsoft.AspNetCore.Html.HtmlString("radio"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_3 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("int-prefix-salt", new global::Microsoft.AspNetCore.Html.HtmlString("8"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); #line hidden public PrefixedAttributeTagHelpers() { @@ -63,14 +63,14 @@ public override async Task ExecuteAsync() #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("int-dictionary", __TestNamespace_InputTagHelper1.IntDictionaryProperty); + __tagHelperExecutionContext.AddTagHelperAttribute("int-dictionary", __TestNamespace_InputTagHelper1.IntDictionaryProperty, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __TestNamespace_InputTagHelper2.IntDictionaryProperty = __TestNamespace_InputTagHelper1.IntDictionaryProperty; #line 16 "PrefixedAttributeTagHelpers.cshtml" __TestNamespace_InputTagHelper1.StringDictionaryProperty = stringDictionary; #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("string-dictionary", __TestNamespace_InputTagHelper1.StringDictionaryProperty); + __tagHelperExecutionContext.AddTagHelperAttribute("string-dictionary", __TestNamespace_InputTagHelper1.StringDictionaryProperty, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __TestNamespace_InputTagHelper2.StringDictionaryProperty = __TestNamespace_InputTagHelper1.StringDictionaryProperty; await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(329, 92, false); @@ -101,21 +101,21 @@ public override async Task ExecuteAsync() #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("int-dictionary", __TestNamespace_InputTagHelper1.IntDictionaryProperty); + __tagHelperExecutionContext.AddTagHelperAttribute("int-dictionary", __TestNamespace_InputTagHelper1.IntDictionaryProperty, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __TestNamespace_InputTagHelper2.IntDictionaryProperty = __TestNamespace_InputTagHelper1.IntDictionaryProperty; #line 17 "PrefixedAttributeTagHelpers.cshtml" __TestNamespace_InputTagHelper1.IntDictionaryProperty["garlic"] = 37; #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("int-prefix-garlic", __TestNamespace_InputTagHelper1.IntDictionaryProperty["garlic"]); + __tagHelperExecutionContext.AddTagHelperAttribute("int-prefix-garlic", __TestNamespace_InputTagHelper1.IntDictionaryProperty["garlic"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __TestNamespace_InputTagHelper2.IntDictionaryProperty["garlic"] = __TestNamespace_InputTagHelper1.IntDictionaryProperty["garlic"]; #line 17 "PrefixedAttributeTagHelpers.cshtml" __TestNamespace_InputTagHelper1.IntProperty = 42; #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("int-prefix-grabber", __TestNamespace_InputTagHelper1.IntProperty); + __tagHelperExecutionContext.AddTagHelperAttribute("int-prefix-grabber", __TestNamespace_InputTagHelper1.IntProperty, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __TestNamespace_InputTagHelper2.IntDictionaryProperty["grabber"] = __TestNamespace_InputTagHelper1.IntProperty; await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(427, 103, false); @@ -154,28 +154,28 @@ public override async Task ExecuteAsync() #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("int-prefix-grabber", __TestNamespace_InputTagHelper1.IntProperty); + __tagHelperExecutionContext.AddTagHelperAttribute("int-prefix-grabber", __TestNamespace_InputTagHelper1.IntProperty, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __TestNamespace_InputTagHelper2.IntDictionaryProperty["grabber"] = __TestNamespace_InputTagHelper1.IntProperty; #line 19 "PrefixedAttributeTagHelpers.cshtml" __TestNamespace_InputTagHelper1.IntDictionaryProperty["salt"] = 37; #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("int-prefix-salt", __TestNamespace_InputTagHelper1.IntDictionaryProperty["salt"]); + __tagHelperExecutionContext.AddTagHelperAttribute("int-prefix-salt", __TestNamespace_InputTagHelper1.IntDictionaryProperty["salt"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __TestNamespace_InputTagHelper2.IntDictionaryProperty["salt"] = __TestNamespace_InputTagHelper1.IntDictionaryProperty["salt"]; #line 19 "PrefixedAttributeTagHelpers.cshtml" __TestNamespace_InputTagHelper1.IntDictionaryProperty["pepper"] = 98; #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("int-prefix-pepper", __TestNamespace_InputTagHelper1.IntDictionaryProperty["pepper"]); + __tagHelperExecutionContext.AddTagHelperAttribute("int-prefix-pepper", __TestNamespace_InputTagHelper1.IntDictionaryProperty["pepper"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __TestNamespace_InputTagHelper2.IntDictionaryProperty["pepper"] = __TestNamespace_InputTagHelper1.IntDictionaryProperty["pepper"]; __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_3); __TestNamespace_InputTagHelper1.StringProperty = "string"; - __tagHelperExecutionContext.AddTagHelperAttribute("string-prefix-grabber", __TestNamespace_InputTagHelper1.StringProperty); + __tagHelperExecutionContext.AddTagHelperAttribute("string-prefix-grabber", __TestNamespace_InputTagHelper1.StringProperty, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __TestNamespace_InputTagHelper2.StringDictionaryProperty["grabber"] = __TestNamespace_InputTagHelper1.StringProperty; __TestNamespace_InputTagHelper1.StringDictionaryProperty["paprika"] = "another string"; - __tagHelperExecutionContext.AddTagHelperAttribute("string-prefix-paprika", __TestNamespace_InputTagHelper1.StringDictionaryProperty["paprika"]); + __tagHelperExecutionContext.AddTagHelperAttribute("string-prefix-paprika", __TestNamespace_InputTagHelper1.StringDictionaryProperty["paprika"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __TestNamespace_InputTagHelper2.StringDictionaryProperty["paprika"] = __TestNamespace_InputTagHelper1.StringDictionaryProperty["paprika"]; BeginWriteTagHelperAttribute(); WriteLiteral("literate "); @@ -187,7 +187,7 @@ public override async Task ExecuteAsync() WriteLiteral("?"); __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); __TestNamespace_InputTagHelper1.StringDictionaryProperty["cumin"] = __tagHelperStringValueBuffer; - __tagHelperExecutionContext.AddTagHelperAttribute("string-prefix-cumin", __TestNamespace_InputTagHelper1.StringDictionaryProperty["cumin"]); + __tagHelperExecutionContext.AddTagHelperAttribute("string-prefix-cumin", __TestNamespace_InputTagHelper1.StringDictionaryProperty["cumin"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __TestNamespace_InputTagHelper2.StringDictionaryProperty["cumin"] = __TestNamespace_InputTagHelper1.StringDictionaryProperty["cumin"]; await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(536, 257, false); @@ -225,10 +225,10 @@ public override async Task ExecuteAsync() #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("int-prefix-value", __TestNamespace_InputTagHelper1.IntDictionaryProperty["value"]); + __tagHelperExecutionContext.AddTagHelperAttribute("int-prefix-value", __TestNamespace_InputTagHelper1.IntDictionaryProperty["value"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __TestNamespace_InputTagHelper2.IntDictionaryProperty["value"] = __TestNamespace_InputTagHelper1.IntDictionaryProperty["value"]; __TestNamespace_InputTagHelper1.StringDictionaryProperty["thyme"] = "string"; - __tagHelperExecutionContext.AddTagHelperAttribute("string-prefix-thyme", __TestNamespace_InputTagHelper1.StringDictionaryProperty["thyme"]); + __tagHelperExecutionContext.AddTagHelperAttribute("string-prefix-thyme", __TestNamespace_InputTagHelper1.StringDictionaryProperty["thyme"], global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __TestNamespace_InputTagHelper2.StringDictionaryProperty["thyme"] = __TestNamespace_InputTagHelper1.StringDictionaryProperty["thyme"]; await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(799, 60, false); diff --git a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/SingleTagHelper.cs b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/SingleTagHelper.cs index cfdf6c8bd..09b6b98cd 100644 --- a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/SingleTagHelper.cs +++ b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/SingleTagHelper.cs @@ -14,7 +14,7 @@ public class SingleTagHelper private global::Microsoft.AspNetCore.Razor.Runtime.TagHelperRunner __tagHelperRunner = null; private global::Microsoft.AspNetCore.Razor.Runtime.TagHelperScopeManager __tagHelperScopeManager = null; private global::TestNamespace.PTagHelper __TestNamespace_PTagHelper = null; - private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("class", new global::Microsoft.AspNetCore.Html.HtmlString("Hello World")); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("class", new global::Microsoft.AspNetCore.Html.HtmlString("Hello World"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); #line hidden public SingleTagHelper() { @@ -42,7 +42,7 @@ public override async Task ExecuteAsync() #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age); + __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { diff --git a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/SingleTagHelperWithNewlineBeforeAttributes.cs b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/SingleTagHelperWithNewlineBeforeAttributes.cs index 6ded36181..57fd3c922 100644 --- a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/SingleTagHelperWithNewlineBeforeAttributes.cs +++ b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/SingleTagHelperWithNewlineBeforeAttributes.cs @@ -14,7 +14,7 @@ public class SingleTagHelperWithNewlineBeforeAttributes private global::Microsoft.AspNetCore.Razor.Runtime.TagHelperRunner __tagHelperRunner = null; private global::Microsoft.AspNetCore.Razor.Runtime.TagHelperScopeManager __tagHelperScopeManager = null; private global::TestNamespace.PTagHelper __TestNamespace_PTagHelper = null; - private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("class", new global::Microsoft.AspNetCore.Html.HtmlString("Hello World")); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("class", new global::Microsoft.AspNetCore.Html.HtmlString("Hello World"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); #line hidden public SingleTagHelperWithNewlineBeforeAttributes() { @@ -42,7 +42,7 @@ public override async Task ExecuteAsync() #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age); + __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { diff --git a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/SymbolBoundAttributes.cs b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/SymbolBoundAttributes.cs index 7256a2152..aeb0b18f4 100644 --- a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/SymbolBoundAttributes.cs +++ b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/SymbolBoundAttributes.cs @@ -15,13 +15,13 @@ public class SymbolBoundAttributes private global::Microsoft.AspNetCore.Razor.Runtime.TagHelperScopeManager __tagHelperScopeManager = null; private global::TestNamespace.CatchAllTagHelper __TestNamespace_CatchAllTagHelper = null; private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("bound"); - private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_1 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("[item]", new global::Microsoft.AspNetCore.Html.HtmlString("items")); - private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_2 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("[(item)]", new global::Microsoft.AspNetCore.Html.HtmlString("items")); - private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_3 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("(click)", new global::Microsoft.AspNetCore.Html.HtmlString("doSomething()")); - private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_4 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("(^click)", new global::Microsoft.AspNetCore.Html.HtmlString("doSomething()")); - private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_5 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("*something", new global::Microsoft.AspNetCore.Html.HtmlString("value")); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_1 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("[item]", new global::Microsoft.AspNetCore.Html.HtmlString("items"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_2 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("[(item)]", new global::Microsoft.AspNetCore.Html.HtmlString("items"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_3 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("(click)", new global::Microsoft.AspNetCore.Html.HtmlString("doSomething()"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_4 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("(^click)", new global::Microsoft.AspNetCore.Html.HtmlString("doSomething()"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_5 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("*something", new global::Microsoft.AspNetCore.Html.HtmlString("value"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_6 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("#localminimized"); - private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_7 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("#local", new global::Microsoft.AspNetCore.Html.HtmlString("value")); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_7 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("#local", new global::Microsoft.AspNetCore.Html.HtmlString("value"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); #line hidden public SymbolBoundAttributes() { @@ -46,7 +46,7 @@ public override async Task ExecuteAsync() #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("[item]", __TestNamespace_CatchAllTagHelper.ListItems); + __tagHelperExecutionContext.AddTagHelperAttribute("[item]", __TestNamespace_CatchAllTagHelper.ListItems, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_1); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(276, 45, false); @@ -67,7 +67,7 @@ public override async Task ExecuteAsync() #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("[(item)]", __TestNamespace_CatchAllTagHelper.ArrayItems); + __tagHelperExecutionContext.AddTagHelperAttribute("[(item)]", __TestNamespace_CatchAllTagHelper.ArrayItems, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_2); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(323, 49, false); @@ -91,7 +91,7 @@ public override async Task ExecuteAsync() #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("(click)", __TestNamespace_CatchAllTagHelper.Event1); + __tagHelperExecutionContext.AddTagHelperAttribute("(click)", __TestNamespace_CatchAllTagHelper.Event1, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_3); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) @@ -119,7 +119,7 @@ public override async Task ExecuteAsync() #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("(^click)", __TestNamespace_CatchAllTagHelper.Event2); + __tagHelperExecutionContext.AddTagHelperAttribute("(^click)", __TestNamespace_CatchAllTagHelper.Event2, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_4); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) @@ -143,7 +143,7 @@ public override async Task ExecuteAsync() __tagHelperExecutionContext.Add(__TestNamespace_CatchAllTagHelper); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_0); __TestNamespace_CatchAllTagHelper.StringProperty1 = "value"; - __tagHelperExecutionContext.AddTagHelperAttribute("*something", __TestNamespace_CatchAllTagHelper.StringProperty1); + __tagHelperExecutionContext.AddTagHelperAttribute("*something", __TestNamespace_CatchAllTagHelper.StringProperty1, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_5); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) @@ -179,7 +179,7 @@ public override async Task ExecuteAsync() __tagHelperExecutionContext.Add(__TestNamespace_CatchAllTagHelper); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_0); __TestNamespace_CatchAllTagHelper.StringProperty2 = "value"; - __tagHelperExecutionContext.AddTagHelperAttribute("#local", __TestNamespace_CatchAllTagHelper.StringProperty2); + __tagHelperExecutionContext.AddTagHelperAttribute("#local", __TestNamespace_CatchAllTagHelper.StringProperty2, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_7); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(642, 47, false); diff --git a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/TagHelpersInSection.cs b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/TagHelpersInSection.cs index 8fd71c57c..1ccaa62c3 100644 --- a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/TagHelpersInSection.cs +++ b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/TagHelpersInSection.cs @@ -86,8 +86,8 @@ public override async Task ExecuteAsync() #line hidden __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); __TestNamespace_MyTagHelper.BoundProperty = __tagHelperStringValueBuffer; - __tagHelperExecutionContext.AddTagHelperAttribute("boundproperty", __TestNamespace_MyTagHelper.BoundProperty); - BeginAddHtmlAttributeValues(__tagHelperExecutionContext, "unboundproperty", 3); + __tagHelperExecutionContext.AddTagHelperAttribute("boundproperty", __TestNamespace_MyTagHelper.BoundProperty, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); + BeginAddHtmlAttributeValues(__tagHelperExecutionContext, "unboundproperty", 3, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); AddHtmlAttributeValue("", 186, "Current", 186, 7, true); AddHtmlAttributeValue(" ", 193, "Time:", 194, 6, true); #line 9 "TagHelpersInSection.cshtml" diff --git a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/TagHelpersWithWeirdlySpacedAttributes.cs b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/TagHelpersWithWeirdlySpacedAttributes.cs index e36649ae0..0ae13f690 100644 --- a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/TagHelpersWithWeirdlySpacedAttributes.cs +++ b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/TagHelpersWithWeirdlySpacedAttributes.cs @@ -14,12 +14,12 @@ public class TagHelpersWithWeirdlySpacedAttributes private global::Microsoft.AspNetCore.Razor.Runtime.TagHelperRunner __tagHelperRunner = null; private global::Microsoft.AspNetCore.Razor.Runtime.TagHelperScopeManager __tagHelperScopeManager = null; private global::TestNamespace.PTagHelper __TestNamespace_PTagHelper = null; - private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("class", new global::Microsoft.AspNetCore.Html.HtmlString("Hello World")); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("class", new global::Microsoft.AspNetCore.Html.HtmlString("Hello World"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); private global::TestNamespace.InputTagHelper __TestNamespace_InputTagHelper = null; private global::TestNamespace.InputTagHelper2 __TestNamespace_InputTagHelper2 = null; - private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_1 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("data-content", new global::Microsoft.AspNetCore.Html.HtmlString("hello")); - private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_2 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("data-content", new global::Microsoft.AspNetCore.Html.HtmlString("hello2")); - private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_3 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("data-content", new global::Microsoft.AspNetCore.Html.HtmlString("blah")); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_1 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("data-content", new global::Microsoft.AspNetCore.Html.HtmlString("hello"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_2 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("data-content", new global::Microsoft.AspNetCore.Html.HtmlString("hello2"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.SingleQuotes); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_3 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("data-content", new global::Microsoft.AspNetCore.Html.HtmlString("blah"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); #line hidden public TagHelpersWithWeirdlySpacedAttributes() { @@ -47,7 +47,7 @@ public override async Task ExecuteAsync() #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age); + __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); BeginWriteTagHelperAttribute(); #line 7 "TagHelpersWithWeirdlySpacedAttributes.cshtml" Write(true); @@ -55,7 +55,7 @@ public override async Task ExecuteAsync() #line default #line hidden __tagHelperStringValueBuffer = EndWriteTagHelperAttribute(); - __tagHelperExecutionContext.AddHtmlAttribute("data-content", Html.Raw(__tagHelperStringValueBuffer)); + __tagHelperExecutionContext.AddHtmlAttribute("data-content", Html.Raw(__tagHelperStringValueBuffer), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { @@ -76,7 +76,7 @@ public override async Task ExecuteAsync() __TestNamespace_InputTagHelper2 = CreateTagHelper(); __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper2); __TestNamespace_InputTagHelper.Type = "text"; - __tagHelperExecutionContext.AddTagHelperAttribute("type", __TestNamespace_InputTagHelper.Type); + __tagHelperExecutionContext.AddTagHelperAttribute("type", __TestNamespace_InputTagHelper.Type, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.SingleQuotes); __TestNamespace_InputTagHelper2.Type = __TestNamespace_InputTagHelper.Type; __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_1); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); @@ -97,7 +97,7 @@ public override async Task ExecuteAsync() #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age); + __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_2); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(173, 46, false); @@ -115,7 +115,7 @@ public override async Task ExecuteAsync() __TestNamespace_InputTagHelper2 = CreateTagHelper(); __tagHelperExecutionContext.Add(__TestNamespace_InputTagHelper2); __TestNamespace_InputTagHelper.Type = "password"; - __tagHelperExecutionContext.AddTagHelperAttribute("type", __TestNamespace_InputTagHelper.Type); + __tagHelperExecutionContext.AddTagHelperAttribute("type", __TestNamespace_InputTagHelper.Type, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); __TestNamespace_InputTagHelper2.Type = __TestNamespace_InputTagHelper.Type; __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_3); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); diff --git a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/TransitionsInTagHelperAttributes.cs b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/TransitionsInTagHelperAttributes.cs index 028d65458..8512fc910 100644 --- a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/TransitionsInTagHelperAttributes.cs +++ b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Output/TransitionsInTagHelperAttributes.cs @@ -14,7 +14,7 @@ public class TransitionsInTagHelperAttributes private global::Microsoft.AspNetCore.Razor.Runtime.TagHelperRunner __tagHelperRunner = null; private global::Microsoft.AspNetCore.Razor.Runtime.TagHelperScopeManager __tagHelperScopeManager = null; private global::TestNamespace.PTagHelper __TestNamespace_PTagHelper = null; - private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("class", new global::Microsoft.AspNetCore.Html.HtmlString("test")); + private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("class", new global::Microsoft.AspNetCore.Html.HtmlString("test"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); #line hidden public TransitionsInTagHelperAttributes() { @@ -44,7 +44,7 @@ public override async Task ExecuteAsync() ); __TestNamespace_PTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__TestNamespace_PTagHelper); - BeginAddHtmlAttributeValues(__tagHelperExecutionContext, "class", 1); + BeginAddHtmlAttributeValues(__tagHelperExecutionContext, "class", 1, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); AddHtmlAttributeValue("", 107, new Template(async(__razor_attribute_value_writer) => { } ), 107, 6, false); @@ -54,7 +54,7 @@ public override async Task ExecuteAsync() #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age); + __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) { @@ -72,7 +72,7 @@ public override async Task ExecuteAsync() ); __TestNamespace_PTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__TestNamespace_PTagHelper); - BeginAddHtmlAttributeValues(__tagHelperExecutionContext, "class", 1); + BeginAddHtmlAttributeValues(__tagHelperExecutionContext, "class", 1, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); #line 8 "TransitionsInTagHelperAttributes.cshtml" AddHtmlAttributeValue("", 153, @class, 153, 9, false); @@ -84,7 +84,7 @@ public override async Task ExecuteAsync() #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age); + __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(143, 34, false); Write(__tagHelperExecutionContext.Output); @@ -104,7 +104,7 @@ public override async Task ExecuteAsync() #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age); + __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(179, 36, false); Write(__tagHelperExecutionContext.Output); @@ -124,7 +124,7 @@ public override async Task ExecuteAsync() #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age); + __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(217, 31, false); Write(__tagHelperExecutionContext.Output); @@ -144,7 +144,7 @@ public override async Task ExecuteAsync() #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age); + __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(250, 34, false); Write(__tagHelperExecutionContext.Output); @@ -158,7 +158,7 @@ public override async Task ExecuteAsync() ); __TestNamespace_PTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__TestNamespace_PTagHelper); - BeginAddHtmlAttributeValues(__tagHelperExecutionContext, "class", 2); + BeginAddHtmlAttributeValues(__tagHelperExecutionContext, "class", 2, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); AddHtmlAttributeValue("", 296, "custom-", 296, 7, true); #line 12 "TransitionsInTagHelperAttributes.cshtml" AddHtmlAttributeValue("", 303, @class, 303, 9, false); @@ -171,7 +171,7 @@ public override async Task ExecuteAsync() #line default #line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age); + __tagHelperExecutionContext.AddTagHelperAttribute("age", __TestNamespace_PTagHelper.Age, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Instrumentation.BeginContext(286, 54, false); Write(__tagHelperExecutionContext.Output); diff --git a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Source/DuplicateAttributeTagHelpers.cshtml b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Source/DuplicateAttributeTagHelpers.cshtml index 2fdedfa70..fb38512fd 100644 --- a/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Source/DuplicateAttributeTagHelpers.cshtml +++ b/test/Microsoft.AspNetCore.Razor.Test/TestFiles/CodeGenerator/Source/DuplicateAttributeTagHelpers.cshtml @@ -3,4 +3,5 @@

      +

      \ No newline at end of file