Reacting to IHtmlContentBuilder changes
This commit is contained in:
parent
e88f90bba0
commit
7d5a68b9ae
|
|
@ -252,7 +252,7 @@ namespace Microsoft.AspNet.Mvc.Razor
|
||||||
}
|
}
|
||||||
|
|
||||||
var tagHelperContent = new DefaultTagHelperContent();
|
var tagHelperContent = new DefaultTagHelperContent();
|
||||||
tagHelperContent.Append(writer.ContentBuilder);
|
tagHelperContent.AppendHtml(writer.ContentBuilder);
|
||||||
return tagHelperContent;
|
return tagHelperContent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -193,7 +193,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
||||||
if (tagBuilder != null)
|
if (tagBuilder != null)
|
||||||
{
|
{
|
||||||
output.MergeAttributes(tagBuilder);
|
output.MergeAttributes(tagBuilder);
|
||||||
output.PostContent.Append(tagBuilder.InnerHtml);
|
output.PostContent.AppendHtml(tagBuilder.InnerHtml);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -202,7 +202,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
||||||
var antiforgeryTag = Generator.GenerateAntiforgery(ViewContext);
|
var antiforgeryTag = Generator.GenerateAntiforgery(ViewContext);
|
||||||
if (antiforgeryTag != null)
|
if (antiforgeryTag != null)
|
||||||
{
|
{
|
||||||
output.PostContent.Append(antiforgeryTag);
|
output.PostContent.AppendHtml(antiforgeryTag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -226,7 +226,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
||||||
// This TagBuilder contains the one <input/> element of interest. Since this is not the "checkbox"
|
// This TagBuilder contains the one <input/> element of interest. Since this is not the "checkbox"
|
||||||
// special-case, output is a self-closing element no longer guaranteed.
|
// special-case, output is a self-closing element no longer guaranteed.
|
||||||
output.MergeAttributes(tagBuilder);
|
output.MergeAttributes(tagBuilder);
|
||||||
output.Content.Append(tagBuilder.InnerHtml);
|
output.Content.AppendHtml(tagBuilder.InnerHtml);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -273,7 +273,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
||||||
var renderingMode =
|
var renderingMode =
|
||||||
output.TagMode == TagMode.SelfClosing ? TagRenderMode.SelfClosing : TagRenderMode.StartTag;
|
output.TagMode == TagMode.SelfClosing ? TagRenderMode.SelfClosing : TagRenderMode.StartTag;
|
||||||
checkBoxTag.TagRenderMode = renderingMode;
|
checkBoxTag.TagRenderMode = renderingMode;
|
||||||
output.Content.Append(checkBoxTag);
|
output.Content.AppendHtml(checkBoxTag);
|
||||||
|
|
||||||
var hiddenForCheckboxTag = Generator.GenerateHiddenForCheckbox(ViewContext, modelExplorer, For.Name);
|
var hiddenForCheckboxTag = Generator.GenerateHiddenForCheckbox(ViewContext, modelExplorer, For.Name);
|
||||||
if (hiddenForCheckboxTag != null)
|
if (hiddenForCheckboxTag != null)
|
||||||
|
|
@ -286,7 +286,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
output.Content.Append(hiddenForCheckboxTag);
|
output.Content.AppendHtml(hiddenForCheckboxTag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -338,7 +338,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
builder.Append(HtmlString.NewLine);
|
builder.AppendHtml(HtmlString.NewLine);
|
||||||
|
|
||||||
// Build the <meta /> tag that's used to test for the presence of the stylesheet
|
// Build the <meta /> tag that's used to test for the presence of the stylesheet
|
||||||
builder
|
builder
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
||||||
// Perf: Avoid allocating enumerator
|
// Perf: Avoid allocating enumerator
|
||||||
for (var i = 0; i < formContext.EndOfFormContent.Count; i++)
|
for (var i = 0; i < formContext.EndOfFormContent.Count; i++)
|
||||||
{
|
{
|
||||||
output.PostContent.Append(formContext.EndOfFormContent[i]);
|
output.PostContent.AppendHtml(formContext.EndOfFormContent[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -130,7 +130,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
||||||
if (tagBuilder != null)
|
if (tagBuilder != null)
|
||||||
{
|
{
|
||||||
output.MergeAttributes(tagBuilder);
|
output.MergeAttributes(tagBuilder);
|
||||||
output.PostContent.Append(tagBuilder.InnerHtml);
|
output.PostContent.AppendHtml(tagBuilder.InnerHtml);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
||||||
if (tagBuilder != null)
|
if (tagBuilder != null)
|
||||||
{
|
{
|
||||||
output.MergeAttributes(tagBuilder);
|
output.MergeAttributes(tagBuilder);
|
||||||
output.PostContent.Append(tagBuilder.InnerHtml);
|
output.PostContent.AppendHtml(tagBuilder.InnerHtml);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ namespace Microsoft.AspNet.Mvc.ViewFeatures.Buffer
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public IHtmlContentBuilder Append(IHtmlContent content)
|
public IHtmlContentBuilder AppendHtml(IHtmlContent content)
|
||||||
{
|
{
|
||||||
if (content == null)
|
if (content == null)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ namespace Microsoft.AspNet.Mvc.ViewFeatures
|
||||||
|
|
||||||
foreach (var item in TriStateValues(value))
|
foreach (var item in TriStateValues(value))
|
||||||
{
|
{
|
||||||
selectTag.InnerHtml.Append(DefaultHtmlGenerator.GenerateOption(item, item.Text));
|
selectTag.InnerHtml.AppendHtml(DefaultHtmlGenerator.GenerateOption(item, item.Text));
|
||||||
}
|
}
|
||||||
|
|
||||||
return selectTag;
|
return selectTag;
|
||||||
|
|
@ -152,7 +152,7 @@ namespace Microsoft.AspNet.Mvc.ViewFeatures
|
||||||
templateName: null,
|
templateName: null,
|
||||||
readOnly: true,
|
readOnly: true,
|
||||||
additionalViewData: null);
|
additionalViewData: null);
|
||||||
result.Append(templateBuilder.Build());
|
result.AppendHtml(templateBuilder.Build());
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
@ -266,7 +266,7 @@ namespace Microsoft.AspNet.Mvc.ViewFeatures
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
content.Append(templateBuilderResult);
|
content.AppendHtml(templateBuilderResult);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@ namespace Microsoft.AspNet.Mvc.ViewFeatures
|
||||||
templateName: null,
|
templateName: null,
|
||||||
readOnly: false,
|
readOnly: false,
|
||||||
additionalViewData: null);
|
additionalViewData: null);
|
||||||
result.Append(templateBuilder.Build());
|
result.AppendHtml(templateBuilder.Build());
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
@ -146,7 +146,7 @@ namespace Microsoft.AspNet.Mvc.ViewFeatures
|
||||||
var result = new HtmlContentBuilder();
|
var result = new HtmlContentBuilder();
|
||||||
if (!viewData.ModelMetadata.HideSurroundingHtml)
|
if (!viewData.ModelMetadata.HideSurroundingHtml)
|
||||||
{
|
{
|
||||||
result.Append(DefaultDisplayTemplates.StringTemplate(htmlHelper));
|
result.AppendHtml(DefaultDisplayTemplates.StringTemplate(htmlHelper));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Special-case opaque values and arbitrary binary data.
|
// Special-case opaque values and arbitrary binary data.
|
||||||
|
|
@ -158,7 +158,7 @@ namespace Microsoft.AspNet.Mvc.ViewFeatures
|
||||||
|
|
||||||
var htmlAttributesObject = viewData[HtmlAttributeKey];
|
var htmlAttributesObject = viewData[HtmlAttributeKey];
|
||||||
var hiddenResult = htmlHelper.Hidden(expression: null, value: model, htmlAttributes: htmlAttributesObject);
|
var hiddenResult = htmlHelper.Hidden(expression: null, value: model, htmlAttributes: htmlAttributesObject);
|
||||||
result.Append(hiddenResult);
|
result.AppendHtml(hiddenResult);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
@ -285,9 +285,9 @@ namespace Microsoft.AspNet.Mvc.ViewFeatures
|
||||||
var valueDivTag = new TagBuilder("div");
|
var valueDivTag = new TagBuilder("div");
|
||||||
valueDivTag.AddCssClass("editor-field");
|
valueDivTag.AddCssClass("editor-field");
|
||||||
|
|
||||||
valueDivTag.InnerHtml.Append(templateBuilderResult);
|
valueDivTag.InnerHtml.AppendHtml(templateBuilderResult);
|
||||||
valueDivTag.InnerHtml.AppendHtml(" ");
|
valueDivTag.InnerHtml.AppendHtml(" ");
|
||||||
valueDivTag.InnerHtml.Append(htmlHelper.ValidationMessage(
|
valueDivTag.InnerHtml.AppendHtml(htmlHelper.ValidationMessage(
|
||||||
propertyMetadata.PropertyName,
|
propertyMetadata.PropertyName,
|
||||||
message: null,
|
message: null,
|
||||||
htmlAttributes: null,
|
htmlAttributes: null,
|
||||||
|
|
@ -297,7 +297,7 @@ namespace Microsoft.AspNet.Mvc.ViewFeatures
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
content.Append(templateBuilderResult);
|
content.AppendHtml(templateBuilderResult);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -848,8 +848,8 @@ namespace Microsoft.AspNet.Mvc.ViewFeatures
|
||||||
tagBuilder.AddCssClass(HtmlHelper.ValidationSummaryCssClassName);
|
tagBuilder.AddCssClass(HtmlHelper.ValidationSummaryCssClassName);
|
||||||
}
|
}
|
||||||
|
|
||||||
tagBuilder.InnerHtml.Append(wrappedMessage);
|
tagBuilder.InnerHtml.AppendHtml(wrappedMessage);
|
||||||
tagBuilder.InnerHtml.Append(htmlSummary);
|
tagBuilder.InnerHtml.AppendHtml(htmlSummary);
|
||||||
|
|
||||||
if (formContext != null && !excludePropertyErrors)
|
if (formContext != null && !excludePropertyErrors)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ namespace Microsoft.AspNet.Mvc.ViewFeatures
|
||||||
throw new ArgumentNullException(nameof(value));
|
throw new ArgumentNullException(nameof(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
ContentBuilder.Append(value);
|
ContentBuilder.AppendHtml(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
|
|
||||||
|
|
@ -757,7 +757,7 @@ namespace Microsoft.AspNet.Mvc.ViewFeatures
|
||||||
return HtmlString.Empty;
|
return HtmlString.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
var checkboxContent = new HtmlContentBuilder().Append(checkbox);
|
var checkboxContent = new HtmlContentBuilder().AppendHtml(checkbox);
|
||||||
|
|
||||||
if (ViewContext.FormContext.CanRenderAtEndOfForm)
|
if (ViewContext.FormContext.CanRenderAtEndOfForm)
|
||||||
{
|
{
|
||||||
|
|
@ -765,7 +765,7 @@ namespace Microsoft.AspNet.Mvc.ViewFeatures
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
checkboxContent.Append(hiddenForCheckboxTag);
|
checkboxContent.AppendHtml(hiddenForCheckboxTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
return checkboxContent;
|
return checkboxContent;
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ namespace Microsoft.AspNet.Mvc.Razor.Buffer
|
||||||
var content = new HtmlString("hello-world");
|
var content = new HtmlString("hello-world");
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
buffer.Append(content);
|
buffer.AppendHtml(content);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
var segment = Assert.Single(buffer.BufferSegments);
|
var segment = Assert.Single(buffer.BufferSegments);
|
||||||
|
|
@ -136,7 +136,7 @@ namespace Microsoft.AspNet.Mvc.Razor.Buffer
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
buffer.Append("Hello");
|
buffer.Append("Hello");
|
||||||
buffer.Append(new HtmlString(" world"));
|
buffer.AppendHtml(new HtmlString(" world"));
|
||||||
buffer.AppendHtml(" 123");
|
buffer.AppendHtml(" 123");
|
||||||
buffer.WriteTo(writer, new HtmlTestEncoder());
|
buffer.WriteTo(writer, new HtmlTestEncoder());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -159,7 +159,7 @@ namespace Microsoft.AspNet.Mvc.ViewFeatures
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IHtmlContentBuilder Append(IHtmlContent content)
|
public IHtmlContentBuilder AppendHtml(IHtmlContent content)
|
||||||
{
|
{
|
||||||
Values.Add(content);
|
Values.Add(content);
|
||||||
return this;
|
return this;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue