Making DefaultDisplayTemplates and DefaultEditorTemplates use IHtmlContent.
- Making TagBuilder's InnerHtml an IHtmlContent. - Delay encoding until the content is written. - Moving BufferedHtmlContent to Common cos it is used in aspnet/Razor also. - Changing GenerateOption to take in a string and create StringHtmlContent. - This reduces the space used by around 13%.
This commit is contained in:
parent
a0da6ec19f
commit
b6a109e2a3
|
|
@ -249,12 +249,12 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
output.Attributes.Clear();
|
||||
output.TagName = null;
|
||||
|
||||
output.Content.Append(tagBuilder.ToString(TagRenderMode.SelfClosing));
|
||||
output.Content.Append(tagBuilder.ToHtmlContent(TagRenderMode.SelfClosing));
|
||||
|
||||
tagBuilder = Generator.GenerateHiddenForCheckbox(ViewContext, modelExplorer, For.Name);
|
||||
if (tagBuilder != null)
|
||||
{
|
||||
output.Content.Append(tagBuilder.ToString(TagRenderMode.SelfClosing));
|
||||
output.Content.Append(tagBuilder.ToHtmlContent(TagRenderMode.SelfClosing));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,113 +0,0 @@
|
|||
// 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 System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Microsoft.AspNet.Html.Abstractions;
|
||||
using Microsoft.Framework.Internal;
|
||||
using Microsoft.Framework.WebEncoders;
|
||||
|
||||
namespace Microsoft.AspNet.Mvc.Rendering
|
||||
{
|
||||
/// <summary>
|
||||
/// Enumerable object collection which knows how to write itself.
|
||||
/// </summary>
|
||||
public class BufferedHtmlContent : IHtmlContent
|
||||
{
|
||||
private const int MaxCharToStringLength = 1024;
|
||||
// This is not List<IHtmlContent> because that would lead to boxing all strings to IHtmlContent
|
||||
// which is not space performant.
|
||||
// internal for testing.
|
||||
internal List<object> Entries { get; } = new List<object>();
|
||||
|
||||
/// <summary>
|
||||
/// Appends the string to the collection.
|
||||
/// </summary>
|
||||
/// <param name="value">The <c>string</c> to be appended.</param>
|
||||
public void Append([NotNull] string value)
|
||||
{
|
||||
Entries.Add(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Appends a character array to the collection.
|
||||
/// </summary>
|
||||
/// <param name="value">The character array to be appended.</param>
|
||||
/// <param name="index">The index from which the character array must be read.</param>
|
||||
/// <param name="count">The count till which the character array must be read.</param>
|
||||
/// <remarks>
|
||||
/// Splits the character array into strings of 1KB length and appends them.
|
||||
/// </remarks>
|
||||
public void Append([NotNull] char[] value, int index, int count)
|
||||
{
|
||||
if (index < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(index));
|
||||
}
|
||||
if (count < 0 || value.Length - index < count)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(count));
|
||||
}
|
||||
|
||||
while (count > 0)
|
||||
{
|
||||
// Split large char arrays into 1KB strings.
|
||||
var currentCount = count;
|
||||
if (MaxCharToStringLength < currentCount)
|
||||
{
|
||||
currentCount = MaxCharToStringLength;
|
||||
}
|
||||
|
||||
Append(new string(value, index, currentCount));
|
||||
index += currentCount;
|
||||
count -= currentCount;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Appends a <see cref="IHtmlContent"/> to the collection.
|
||||
/// </summary>
|
||||
/// <param name="htmlContent">The <see cref="IHtmlContent"/> to be appended.</param>
|
||||
public void Append([NotNull] IHtmlContent htmlContent)
|
||||
{
|
||||
Entries.Add(htmlContent);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes all the entries from the collection.
|
||||
/// </summary>
|
||||
public void Clear()
|
||||
{
|
||||
Entries.Clear();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void WriteTo([NotNull] TextWriter writer, [NotNull] IHtmlEncoder encoder)
|
||||
{
|
||||
foreach (var entry in Entries)
|
||||
{
|
||||
var entryAsString = entry as string;
|
||||
if (entryAsString != null)
|
||||
{
|
||||
writer.Write(entryAsString);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Only string, IHtmlContent values can be added to the buffer.
|
||||
((IHtmlContent)entry).WriteTo(writer, encoder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string ToString()
|
||||
{
|
||||
using (var writer = new StringWriter())
|
||||
{
|
||||
WriteTo(writer, new HtmlEncoder());
|
||||
return writer.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -6,17 +6,18 @@ using System.Collections;
|
|||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
using Microsoft.AspNet.Html.Abstractions;
|
||||
using Microsoft.AspNet.Mvc.ModelBinding;
|
||||
using Microsoft.AspNet.Mvc.Rendering.Internal;
|
||||
using Microsoft.AspNet.Mvc.ViewFeatures;
|
||||
using Microsoft.Framework.DependencyInjection;
|
||||
using Microsoft.Framework.Internal;
|
||||
|
||||
namespace Microsoft.AspNet.Mvc.Rendering
|
||||
{
|
||||
public static class DefaultDisplayTemplates
|
||||
{
|
||||
public static string BooleanTemplate(IHtmlHelper htmlHelper)
|
||||
public static IHtmlContent BooleanTemplate(IHtmlHelper htmlHelper)
|
||||
{
|
||||
bool? value = null;
|
||||
if (htmlHelper.ViewData.Model != null)
|
||||
|
|
@ -29,9 +30,9 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
BooleanTemplateCheckbox(value ?? false, htmlHelper);
|
||||
}
|
||||
|
||||
private static string BooleanTemplateCheckbox(bool value, IHtmlHelper htmlHelper)
|
||||
private static IHtmlContent BooleanTemplateCheckbox(bool value, IHtmlHelper htmlHelper)
|
||||
{
|
||||
var inputTag = new TagBuilder("input", htmlHelper.HtmlEncoder);
|
||||
var inputTag = new TagBuilder("input");
|
||||
inputTag.AddCssClass("check-box");
|
||||
inputTag.Attributes["disabled"] = "disabled";
|
||||
inputTag.Attributes["type"] = "checkbox";
|
||||
|
|
@ -40,28 +41,28 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
inputTag.Attributes["checked"] = "checked";
|
||||
}
|
||||
|
||||
return inputTag.ToString(TagRenderMode.SelfClosing);
|
||||
return inputTag.ToHtmlContent(TagRenderMode.SelfClosing);
|
||||
}
|
||||
|
||||
private static string BooleanTemplateDropDownList(IHtmlHelper htmlHelper, bool? value)
|
||||
private static IHtmlContent BooleanTemplateDropDownList(IHtmlHelper htmlHelper, bool? value)
|
||||
{
|
||||
var selectTag = new TagBuilder("select", htmlHelper.HtmlEncoder);
|
||||
var selectTag = new TagBuilder("select");
|
||||
selectTag.AddCssClass("list-box");
|
||||
selectTag.AddCssClass("tri-state");
|
||||
selectTag.Attributes["disabled"] = "disabled";
|
||||
|
||||
var builder = new StringBuilder();
|
||||
builder.Append(selectTag.ToString(TagRenderMode.StartTag));
|
||||
var content = new BufferedHtmlContent();
|
||||
content.Append(selectTag.ToHtmlContent(TagRenderMode.StartTag));
|
||||
|
||||
foreach (var item in TriStateValues(value))
|
||||
{
|
||||
var encodedText = htmlHelper.Encode(item.Text);
|
||||
var option = DefaultHtmlGenerator.GenerateOption(item, encodedText, htmlHelper.HtmlEncoder);
|
||||
builder.Append(option);
|
||||
content.Append(
|
||||
DefaultHtmlGenerator.GenerateOption(item, item.Text)
|
||||
.ToHtmlContent(TagRenderMode.Normal));
|
||||
}
|
||||
|
||||
builder.Append(selectTag.ToString(TagRenderMode.EndTag));
|
||||
return builder.ToString();
|
||||
content.Append(selectTag.ToHtmlContent(TagRenderMode.EndTag));
|
||||
return content;
|
||||
}
|
||||
|
||||
// Will soon need to be shared with the default editor templates implementations.
|
||||
|
|
@ -90,12 +91,12 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
};
|
||||
}
|
||||
|
||||
public static string CollectionTemplate(IHtmlHelper htmlHelper)
|
||||
public static IHtmlContent CollectionTemplate(IHtmlHelper htmlHelper)
|
||||
{
|
||||
var model = htmlHelper.ViewData.Model;
|
||||
if (model == null)
|
||||
{
|
||||
return string.Empty;
|
||||
return HtmlString.Empty;
|
||||
}
|
||||
|
||||
var collection = model as IEnumerable;
|
||||
|
|
@ -125,7 +126,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
htmlHelper.ViewData.TemplateInfo.HtmlFieldPrefix = string.Empty;
|
||||
|
||||
var fieldNameBase = oldPrefix;
|
||||
var result = new StringBuilder();
|
||||
var result = new BufferedHtmlContent();
|
||||
var viewEngine = serviceProvider.GetRequiredService<ICompositeViewEngine>();
|
||||
|
||||
var index = 0;
|
||||
|
|
@ -153,12 +154,10 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
templateName: null,
|
||||
readOnly: true,
|
||||
additionalViewData: null);
|
||||
|
||||
var output = templateBuilder.Build();
|
||||
result.Append(output);
|
||||
result.Append(templateBuilder.Build());
|
||||
}
|
||||
|
||||
return result.ToString();
|
||||
return result;
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
|
@ -166,7 +165,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
}
|
||||
}
|
||||
|
||||
public static string DecimalTemplate(IHtmlHelper htmlHelper)
|
||||
public static IHtmlContent DecimalTemplate(IHtmlHelper htmlHelper)
|
||||
{
|
||||
if (htmlHelper.ViewData.TemplateInfo.FormattedModelValue == htmlHelper.ViewData.Model)
|
||||
{
|
||||
|
|
@ -177,7 +176,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
return StringTemplate(htmlHelper);
|
||||
}
|
||||
|
||||
public static string EmailAddressTemplate(IHtmlHelper htmlHelper)
|
||||
public static IHtmlContent EmailAddressTemplate(IHtmlHelper htmlHelper)
|
||||
{
|
||||
var uriString = "mailto:" + ((htmlHelper.ViewData.Model == null) ?
|
||||
string.Empty :
|
||||
|
|
@ -189,31 +188,31 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
return HyperlinkTemplate(uriString, linkedText, htmlHelper);
|
||||
}
|
||||
|
||||
public static string HiddenInputTemplate(IHtmlHelper htmlHelper)
|
||||
public static IHtmlContent HiddenInputTemplate(IHtmlHelper htmlHelper)
|
||||
{
|
||||
if (htmlHelper.ViewData.ModelMetadata.HideSurroundingHtml)
|
||||
{
|
||||
return string.Empty;
|
||||
return HtmlString.Empty;
|
||||
}
|
||||
|
||||
return StringTemplate(htmlHelper);
|
||||
}
|
||||
|
||||
public static string HtmlTemplate(IHtmlHelper htmlHelper)
|
||||
public static IHtmlContent HtmlTemplate(IHtmlHelper htmlHelper)
|
||||
{
|
||||
return htmlHelper.ViewData.TemplateInfo.FormattedModelValue.ToString();
|
||||
return new HtmlString(htmlHelper.ViewData.TemplateInfo.FormattedModelValue.ToString());
|
||||
}
|
||||
|
||||
public static string ObjectTemplate(IHtmlHelper htmlHelper)
|
||||
public static IHtmlContent ObjectTemplate(IHtmlHelper htmlHelper)
|
||||
{
|
||||
var viewData = htmlHelper.ViewData;
|
||||
var templateInfo = viewData.TemplateInfo;
|
||||
var modelExplorer = viewData.ModelExplorer;
|
||||
var builder = new StringBuilder();
|
||||
var content = new BufferedHtmlContent();
|
||||
|
||||
if (modelExplorer.Model == null)
|
||||
{
|
||||
return modelExplorer.Metadata.NullDisplayText;
|
||||
return new HtmlString(modelExplorer.Metadata.NullDisplayText);
|
||||
}
|
||||
|
||||
if (templateInfo.TemplateDepth > 1)
|
||||
|
|
@ -224,7 +223,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
text = htmlHelper.Encode(text);
|
||||
}
|
||||
|
||||
return text;
|
||||
return new HtmlString(text);
|
||||
}
|
||||
|
||||
var serviceProvider = htmlHelper.ViewContext.HttpContext.RequestServices;
|
||||
|
|
@ -238,7 +237,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
continue;
|
||||
}
|
||||
|
||||
var divTag = new TagBuilder("div", htmlHelper.HtmlEncoder);
|
||||
var divTag = new TagBuilder("div");
|
||||
|
||||
if (!propertyMetadata.HideSurroundingHtml)
|
||||
{
|
||||
|
|
@ -247,14 +246,14 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
{
|
||||
divTag.SetInnerText(label);
|
||||
divTag.AddCssClass("display-label");
|
||||
builder.AppendLine(divTag.ToString(TagRenderMode.Normal));
|
||||
content.AppendLine(divTag.ToHtmlContent(TagRenderMode.Normal));
|
||||
|
||||
// Reset divTag for reuse.
|
||||
divTag.Attributes.Clear();
|
||||
}
|
||||
|
||||
divTag.AddCssClass("display-field");
|
||||
builder.Append(divTag.ToString(TagRenderMode.StartTag));
|
||||
content.Append(divTag.ToHtmlContent(TagRenderMode.StartTag));
|
||||
}
|
||||
|
||||
var templateBuilder = new TemplateBuilder(
|
||||
|
|
@ -267,15 +266,15 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
readOnly: true,
|
||||
additionalViewData: null);
|
||||
|
||||
builder.Append(templateBuilder.Build());
|
||||
content.Append(templateBuilder.Build());
|
||||
|
||||
if (!propertyMetadata.HideSurroundingHtml)
|
||||
{
|
||||
builder.AppendLine(divTag.ToString(TagRenderMode.EndTag));
|
||||
content.AppendLine(divTag.ToHtmlContent(TagRenderMode.EndTag));
|
||||
}
|
||||
}
|
||||
|
||||
return builder.ToString();
|
||||
return content;
|
||||
}
|
||||
|
||||
private static bool ShouldShow(ModelExplorer modelExplorer, TemplateInfo templateInfo)
|
||||
|
|
@ -286,12 +285,18 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
!templateInfo.Visited(modelExplorer);
|
||||
}
|
||||
|
||||
public static string StringTemplate(IHtmlHelper htmlHelper)
|
||||
public static IHtmlContent StringTemplate(IHtmlHelper htmlHelper)
|
||||
{
|
||||
return htmlHelper.Encode(htmlHelper.ViewData.TemplateInfo.FormattedModelValue);
|
||||
var value = htmlHelper.ViewData.TemplateInfo.FormattedModelValue;
|
||||
if (value == null)
|
||||
{
|
||||
return HtmlString.Empty;
|
||||
}
|
||||
|
||||
return new StringHtmlContent(value.ToString());
|
||||
}
|
||||
|
||||
public static string UrlTemplate(IHtmlHelper htmlHelper)
|
||||
public static IHtmlContent UrlTemplate(IHtmlHelper htmlHelper)
|
||||
{
|
||||
var uriString = (htmlHelper.ViewData.Model == null) ? string.Empty : htmlHelper.ViewData.Model.ToString();
|
||||
var linkedText = (htmlHelper.ViewData.TemplateInfo.FormattedModelValue == null) ?
|
||||
|
|
@ -302,13 +307,13 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
}
|
||||
|
||||
// Neither uriString nor linkedText need be encoded prior to calling this method.
|
||||
private static string HyperlinkTemplate(string uriString, string linkedText, IHtmlHelper htmlHelper)
|
||||
private static IHtmlContent HyperlinkTemplate(string uriString, string linkedText, IHtmlHelper htmlHelper)
|
||||
{
|
||||
var hyperlinkTag = new TagBuilder("a", htmlHelper.HtmlEncoder);
|
||||
var hyperlinkTag = new TagBuilder("a");
|
||||
hyperlinkTag.MergeAttribute("href", uriString);
|
||||
hyperlinkTag.SetInnerText(linkedText);
|
||||
|
||||
return hyperlinkTag.ToString(TagRenderMode.Normal);
|
||||
return hyperlinkTag.ToHtmlContent(TagRenderMode.Normal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ using System.Collections.Generic;
|
|||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
using Microsoft.AspNet.Html.Abstractions;
|
||||
using Microsoft.AspNet.Mvc.ModelBinding;
|
||||
using Microsoft.AspNet.Mvc.Rendering.Internal;
|
||||
using Microsoft.AspNet.Mvc.ViewFeatures;
|
||||
|
|
@ -19,7 +20,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
{
|
||||
private const string HtmlAttributeKey = "htmlAttributes";
|
||||
|
||||
public static string BooleanTemplate(IHtmlHelper htmlHelper)
|
||||
public static IHtmlContent BooleanTemplate(IHtmlHelper htmlHelper)
|
||||
{
|
||||
bool? value = null;
|
||||
if (htmlHelper.ViewData.Model != null)
|
||||
|
|
@ -32,32 +33,30 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
BooleanTemplateCheckbox(htmlHelper, value ?? false);
|
||||
}
|
||||
|
||||
private static string BooleanTemplateCheckbox(IHtmlHelper htmlHelper, bool value)
|
||||
private static IHtmlContent BooleanTemplateCheckbox(IHtmlHelper htmlHelper, bool value)
|
||||
{
|
||||
return htmlHelper.CheckBox(
|
||||
expression: null,
|
||||
isChecked: value,
|
||||
htmlAttributes: CreateHtmlAttributes(htmlHelper, "check-box"))
|
||||
.ToString();
|
||||
htmlAttributes: CreateHtmlAttributes(htmlHelper, "check-box"));
|
||||
}
|
||||
|
||||
private static string BooleanTemplateDropDownList(IHtmlHelper htmlHelper, bool? value)
|
||||
private static IHtmlContent BooleanTemplateDropDownList(IHtmlHelper htmlHelper, bool? value)
|
||||
{
|
||||
return htmlHelper.DropDownList(
|
||||
expression: null,
|
||||
selectList: DefaultDisplayTemplates.TriStateValues(value),
|
||||
optionLabel: null,
|
||||
htmlAttributes: CreateHtmlAttributes(htmlHelper, "list-box tri-state"))
|
||||
.ToString();
|
||||
htmlAttributes: CreateHtmlAttributes(htmlHelper, "list-box tri-state"));
|
||||
}
|
||||
|
||||
public static string CollectionTemplate(IHtmlHelper htmlHelper)
|
||||
public static IHtmlContent CollectionTemplate(IHtmlHelper htmlHelper)
|
||||
{
|
||||
var viewData = htmlHelper.ViewData;
|
||||
var model = viewData.Model;
|
||||
if (model == null)
|
||||
{
|
||||
return string.Empty;
|
||||
return HtmlString.Empty;
|
||||
}
|
||||
|
||||
var collection = model as IEnumerable;
|
||||
|
|
@ -87,7 +86,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
viewData.TemplateInfo.HtmlFieldPrefix = string.Empty;
|
||||
|
||||
var fieldNameBase = oldPrefix;
|
||||
var result = new StringBuilder();
|
||||
var result = new BufferedHtmlContent();
|
||||
var viewEngine = serviceProvider.GetRequiredService<ICompositeViewEngine>();
|
||||
|
||||
var index = 0;
|
||||
|
|
@ -115,12 +114,10 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
templateName: null,
|
||||
readOnly: false,
|
||||
additionalViewData: null);
|
||||
|
||||
var output = templateBuilder.Build();
|
||||
result.Append(output);
|
||||
result.Append(templateBuilder.Build());
|
||||
}
|
||||
|
||||
return result.ToString();
|
||||
return result;
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
|
@ -128,7 +125,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
}
|
||||
}
|
||||
|
||||
public static string DecimalTemplate(IHtmlHelper htmlHelper)
|
||||
public static IHtmlContent DecimalTemplate(IHtmlHelper htmlHelper)
|
||||
{
|
||||
if (htmlHelper.ViewData.TemplateInfo.FormattedModelValue == htmlHelper.ViewData.Model)
|
||||
{
|
||||
|
|
@ -139,19 +136,15 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
return StringTemplate(htmlHelper);
|
||||
}
|
||||
|
||||
public static string HiddenInputTemplate(IHtmlHelper htmlHelper)
|
||||
public static IHtmlContent HiddenInputTemplate(IHtmlHelper htmlHelper)
|
||||
{
|
||||
var viewData = htmlHelper.ViewData;
|
||||
var model = viewData.Model;
|
||||
|
||||
string result;
|
||||
if (viewData.ModelMetadata.HideSurroundingHtml)
|
||||
var result = new BufferedHtmlContent();
|
||||
if (!viewData.ModelMetadata.HideSurroundingHtml)
|
||||
{
|
||||
result = string.Empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = DefaultDisplayTemplates.StringTemplate(htmlHelper);
|
||||
result.Append(DefaultDisplayTemplates.StringTemplate(htmlHelper));
|
||||
}
|
||||
|
||||
// Special-case opaque values and arbitrary binary data.
|
||||
|
|
@ -163,7 +156,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
|
||||
var htmlAttributesObject = viewData[HtmlAttributeKey];
|
||||
var hiddenResult = htmlHelper.Hidden(expression: null, value: model, htmlAttributes: htmlAttributesObject);
|
||||
result += hiddenResult.ToString();
|
||||
result.Append(hiddenResult);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
@ -219,43 +212,42 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
return htmlAttributes;
|
||||
}
|
||||
|
||||
public static string MultilineTemplate(IHtmlHelper htmlHelper)
|
||||
public static IHtmlContent MultilineTemplate(IHtmlHelper htmlHelper)
|
||||
{
|
||||
var htmlString = htmlHelper.TextArea(
|
||||
return htmlHelper.TextArea(
|
||||
expression: string.Empty,
|
||||
value: htmlHelper.ViewContext.ViewData.TemplateInfo.FormattedModelValue.ToString(),
|
||||
rows: 0,
|
||||
columns: 0,
|
||||
htmlAttributes: CreateHtmlAttributes(htmlHelper, "text-box multi-line"));
|
||||
return htmlString.ToString();
|
||||
}
|
||||
|
||||
public static string ObjectTemplate(IHtmlHelper htmlHelper)
|
||||
public static IHtmlContent ObjectTemplate(IHtmlHelper htmlHelper)
|
||||
{
|
||||
var viewData = htmlHelper.ViewData;
|
||||
var templateInfo = viewData.TemplateInfo;
|
||||
var modelExplorer = viewData.ModelExplorer;
|
||||
var builder = new StringBuilder();
|
||||
|
||||
if (templateInfo.TemplateDepth > 1)
|
||||
{
|
||||
if (modelExplorer.Model == null)
|
||||
{
|
||||
return modelExplorer.Metadata.NullDisplayText;
|
||||
return new HtmlString(modelExplorer.Metadata.NullDisplayText);
|
||||
}
|
||||
|
||||
var text = modelExplorer.GetSimpleDisplayText();
|
||||
if (modelExplorer.Metadata.HtmlEncode)
|
||||
{
|
||||
text = htmlHelper.Encode(text);
|
||||
return new StringHtmlContent(text);
|
||||
}
|
||||
|
||||
return text;
|
||||
return new HtmlString(text);
|
||||
}
|
||||
|
||||
var serviceProvider = htmlHelper.ViewContext.HttpContext.RequestServices;
|
||||
var viewEngine = serviceProvider.GetRequiredService<ICompositeViewEngine>();
|
||||
|
||||
var content = new BufferedHtmlContent();
|
||||
foreach (var propertyExplorer in modelExplorer.Properties)
|
||||
{
|
||||
var propertyMetadata = propertyExplorer.Metadata;
|
||||
|
|
@ -264,27 +256,26 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
continue;
|
||||
}
|
||||
|
||||
var divTag = new TagBuilder("div", htmlHelper.HtmlEncoder);
|
||||
var divTag = new TagBuilder("div");
|
||||
|
||||
if (!propertyMetadata.HideSurroundingHtml)
|
||||
{
|
||||
var label = htmlHelper.Label(
|
||||
propertyMetadata.PropertyName,
|
||||
labelText: null,
|
||||
htmlAttributes: null)
|
||||
.ToString();
|
||||
if (!string.IsNullOrEmpty(label))
|
||||
htmlAttributes: null);
|
||||
if (!string.IsNullOrEmpty(label.ToString()))
|
||||
{
|
||||
divTag.AddCssClass("editor-label");
|
||||
divTag.InnerHtml = label; // already escaped
|
||||
builder.AppendLine(divTag.ToString(TagRenderMode.Normal));
|
||||
content.AppendLine(divTag.ToHtmlContent(TagRenderMode.Normal));
|
||||
|
||||
// Reset divTag for reuse.
|
||||
divTag.Attributes.Clear();
|
||||
}
|
||||
|
||||
divTag.AddCssClass("editor-field");
|
||||
builder.Append(divTag.ToString(TagRenderMode.StartTag));
|
||||
content.Append(divTag.ToHtmlContent(TagRenderMode.StartTag));
|
||||
}
|
||||
|
||||
var templateBuilder = new TemplateBuilder(
|
||||
|
|
@ -297,31 +288,30 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
readOnly: false,
|
||||
additionalViewData: null);
|
||||
|
||||
builder.Append(templateBuilder.Build());
|
||||
content.Append(templateBuilder.Build());
|
||||
|
||||
if (!propertyMetadata.HideSurroundingHtml)
|
||||
{
|
||||
builder.Append(" ");
|
||||
builder.Append(htmlHelper.ValidationMessage(
|
||||
content.Append(" ");
|
||||
content.Append(htmlHelper.ValidationMessage(
|
||||
propertyMetadata.PropertyName,
|
||||
message: null,
|
||||
htmlAttributes: null,
|
||||
tag: null));
|
||||
|
||||
builder.AppendLine(divTag.ToString(TagRenderMode.EndTag));
|
||||
content.AppendLine(divTag.ToHtmlContent(TagRenderMode.EndTag));
|
||||
}
|
||||
}
|
||||
|
||||
return builder.ToString();
|
||||
return content;
|
||||
}
|
||||
|
||||
public static string PasswordTemplate(IHtmlHelper htmlHelper)
|
||||
public static IHtmlContent PasswordTemplate(IHtmlHelper htmlHelper)
|
||||
{
|
||||
return htmlHelper.Password(
|
||||
expression: null,
|
||||
value: htmlHelper.ViewData.TemplateInfo.FormattedModelValue,
|
||||
htmlAttributes: CreateHtmlAttributes(htmlHelper, "text-box single-line password"))
|
||||
.ToString();
|
||||
htmlAttributes: CreateHtmlAttributes(htmlHelper, "text-box single-line password"));
|
||||
}
|
||||
|
||||
private static bool ShouldShow(ModelExplorer modelExplorer, TemplateInfo templateInfo)
|
||||
|
|
@ -332,61 +322,61 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
!templateInfo.Visited(modelExplorer);
|
||||
}
|
||||
|
||||
public static string StringTemplate(IHtmlHelper htmlHelper)
|
||||
public static IHtmlContent StringTemplate(IHtmlHelper htmlHelper)
|
||||
{
|
||||
return GenerateTextBox(htmlHelper);
|
||||
}
|
||||
|
||||
public static string PhoneNumberInputTemplate(IHtmlHelper htmlHelper)
|
||||
public static IHtmlContent PhoneNumberInputTemplate(IHtmlHelper htmlHelper)
|
||||
{
|
||||
return GenerateTextBox(htmlHelper, inputType: "tel");
|
||||
}
|
||||
|
||||
public static string UrlInputTemplate(IHtmlHelper htmlHelper)
|
||||
public static IHtmlContent UrlInputTemplate(IHtmlHelper htmlHelper)
|
||||
{
|
||||
return GenerateTextBox(htmlHelper, inputType: "url");
|
||||
}
|
||||
|
||||
public static string EmailAddressInputTemplate(IHtmlHelper htmlHelper)
|
||||
public static IHtmlContent EmailAddressInputTemplate(IHtmlHelper htmlHelper)
|
||||
{
|
||||
return GenerateTextBox(htmlHelper, inputType: "email");
|
||||
}
|
||||
|
||||
public static string DateTimeInputTemplate(IHtmlHelper htmlHelper)
|
||||
public static IHtmlContent DateTimeInputTemplate(IHtmlHelper htmlHelper)
|
||||
{
|
||||
ApplyRfc3339DateFormattingIfNeeded(htmlHelper, "{0:yyyy-MM-ddTHH:mm:ss.fffK}");
|
||||
return GenerateTextBox(htmlHelper, inputType: "datetime");
|
||||
}
|
||||
|
||||
public static string DateTimeLocalInputTemplate(IHtmlHelper htmlHelper)
|
||||
public static IHtmlContent DateTimeLocalInputTemplate(IHtmlHelper htmlHelper)
|
||||
{
|
||||
ApplyRfc3339DateFormattingIfNeeded(htmlHelper, "{0:yyyy-MM-ddTHH:mm:ss.fff}");
|
||||
return GenerateTextBox(htmlHelper, inputType: "datetime-local");
|
||||
}
|
||||
|
||||
public static string DateInputTemplate(IHtmlHelper htmlHelper)
|
||||
public static IHtmlContent DateInputTemplate(IHtmlHelper htmlHelper)
|
||||
{
|
||||
ApplyRfc3339DateFormattingIfNeeded(htmlHelper, "{0:yyyy-MM-dd}");
|
||||
return GenerateTextBox(htmlHelper, inputType: "date");
|
||||
}
|
||||
|
||||
public static string TimeInputTemplate(IHtmlHelper htmlHelper)
|
||||
public static IHtmlContent TimeInputTemplate(IHtmlHelper htmlHelper)
|
||||
{
|
||||
ApplyRfc3339DateFormattingIfNeeded(htmlHelper, "{0:HH:mm:ss.fff}");
|
||||
return GenerateTextBox(htmlHelper, inputType: "time");
|
||||
}
|
||||
|
||||
public static string NumberInputTemplate(IHtmlHelper htmlHelper)
|
||||
public static IHtmlContent NumberInputTemplate(IHtmlHelper htmlHelper)
|
||||
{
|
||||
return GenerateTextBox(htmlHelper, inputType: "number");
|
||||
}
|
||||
|
||||
public static string FileInputTemplate([NotNull] IHtmlHelper htmlHelper)
|
||||
public static IHtmlContent FileInputTemplate([NotNull] IHtmlHelper htmlHelper)
|
||||
{
|
||||
return GenerateTextBox(htmlHelper, inputType: "file");
|
||||
}
|
||||
|
||||
public static string FileCollectionInputTemplate([NotNull] IHtmlHelper htmlHelper)
|
||||
public static IHtmlContent FileCollectionInputTemplate([NotNull] IHtmlHelper htmlHelper)
|
||||
{
|
||||
var htmlAttributes =
|
||||
CreateHtmlAttributes(htmlHelper, className: "text-box single-line", inputType: "file");
|
||||
|
|
@ -416,12 +406,12 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
}
|
||||
}
|
||||
|
||||
private static string GenerateTextBox(IHtmlHelper htmlHelper, string inputType = null)
|
||||
private static IHtmlContent GenerateTextBox(IHtmlHelper htmlHelper, string inputType = null)
|
||||
{
|
||||
return GenerateTextBox(htmlHelper, inputType, htmlHelper.ViewData.TemplateInfo.FormattedModelValue);
|
||||
}
|
||||
|
||||
private static string GenerateTextBox(IHtmlHelper htmlHelper, string inputType, object value)
|
||||
private static IHtmlContent GenerateTextBox(IHtmlHelper htmlHelper, string inputType, object value)
|
||||
{
|
||||
var htmlAttributes =
|
||||
CreateHtmlAttributes(htmlHelper, className: "text-box single-line", inputType: inputType);
|
||||
|
|
@ -429,14 +419,13 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
return GenerateTextBox(htmlHelper, value, htmlAttributes);
|
||||
}
|
||||
|
||||
private static string GenerateTextBox(IHtmlHelper htmlHelper, object value, object htmlAttributes)
|
||||
private static IHtmlContent GenerateTextBox(IHtmlHelper htmlHelper, object value, object htmlAttributes)
|
||||
{
|
||||
return htmlHelper.TextBox(
|
||||
current: null,
|
||||
value: value,
|
||||
format: null,
|
||||
htmlAttributes: htmlAttributes)
|
||||
.ToString();
|
||||
htmlAttributes: htmlAttributes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ using System.Linq;
|
|||
using System.Reflection;
|
||||
using System.Text;
|
||||
using Microsoft.AspNet.Antiforgery;
|
||||
using Microsoft.AspNet.Html.Abstractions;
|
||||
using Microsoft.AspNet.Mvc.ModelBinding;
|
||||
using Microsoft.AspNet.Mvc.ModelBinding.Validation;
|
||||
using Microsoft.AspNet.Mvc.Rendering.Expressions;
|
||||
|
|
@ -96,7 +97,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual HtmlString GenerateAntiforgery([NotNull] ViewContext viewContext)
|
||||
public virtual IHtmlContent GenerateAntiforgery([NotNull] ViewContext viewContext)
|
||||
{
|
||||
var tag = _antiforgery.GetHtml(viewContext.HttpContext);
|
||||
return new HtmlString(tag);
|
||||
|
|
@ -153,7 +154,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
ModelExplorer modelExplorer,
|
||||
string expression)
|
||||
{
|
||||
var tagBuilder = new TagBuilder("input", _htmlEncoder);
|
||||
var tagBuilder = new TagBuilder("input");
|
||||
tagBuilder.MergeAttribute("type", GetInputTypeString(InputType.Hidden));
|
||||
tagBuilder.MergeAttribute("value", "false");
|
||||
|
||||
|
|
@ -266,7 +267,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
return null;
|
||||
}
|
||||
|
||||
var tagBuilder = new TagBuilder("label", _htmlEncoder);
|
||||
var tagBuilder = new TagBuilder("label");
|
||||
var idString =
|
||||
TagBuilder.CreateSanitizedId(GetFullHtmlFieldName(viewContext, expression), IdAttributeDotReplacement);
|
||||
tagBuilder.Attributes.Add("for", idString);
|
||||
|
|
@ -439,9 +440,9 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
// Convert each ListItem to an <option> tag and wrap them with <optgroup> if requested.
|
||||
var listItemBuilder = GenerateGroupsAndOptions(optionLabel, selectList);
|
||||
|
||||
var tagBuilder = new TagBuilder("select", _htmlEncoder)
|
||||
var tagBuilder = new TagBuilder("select")
|
||||
{
|
||||
InnerHtml = listItemBuilder.ToString()
|
||||
InnerHtml = listItemBuilder
|
||||
};
|
||||
tagBuilder.MergeAttributes(GetHtmlAttributeDictionaryOrNull(htmlAttributes));
|
||||
tagBuilder.MergeAttribute("name", fullName, true /* replaceExisting */);
|
||||
|
|
@ -513,7 +514,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
value = modelExplorer.Model.ToString();
|
||||
}
|
||||
|
||||
var tagBuilder = new TagBuilder("textarea", _htmlEncoder);
|
||||
var tagBuilder = new TagBuilder("textarea");
|
||||
tagBuilder.GenerateId(fullName, IdAttributeDotReplacement);
|
||||
tagBuilder.MergeAttributes(GetHtmlAttributeDictionaryOrNull(htmlAttributes), true);
|
||||
if (rows > 0)
|
||||
|
|
@ -537,7 +538,10 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
|
||||
// The first newline is always trimmed when a TextArea is rendered, so we add an extra one
|
||||
// in case the value being rendered is something like "\r\nHello".
|
||||
tagBuilder.InnerHtml = Environment.NewLine + _htmlEncoder.HtmlEncode(value);
|
||||
var innerContent = new BufferedHtmlContent();
|
||||
innerContent.Append(Environment.NewLine);
|
||||
innerContent.Append(new StringHtmlContent(value));
|
||||
tagBuilder.InnerHtml = innerContent;
|
||||
|
||||
return tagBuilder;
|
||||
}
|
||||
|
|
@ -614,7 +618,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
{
|
||||
tag = viewContext.ValidationMessageElement;
|
||||
}
|
||||
var tagBuilder = new TagBuilder(tag, _htmlEncoder);
|
||||
var tagBuilder = new TagBuilder(tag);
|
||||
tagBuilder.MergeAttributes(GetHtmlAttributeDictionaryOrNull(htmlAttributes));
|
||||
|
||||
// Only the style of the span is changed according to the errors if message is null or empty.
|
||||
|
|
@ -660,16 +664,16 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
return null;
|
||||
}
|
||||
|
||||
string wrappedMessage;
|
||||
var wrappedMessage = new BufferedHtmlContent();
|
||||
if (!string.IsNullOrEmpty(message))
|
||||
{
|
||||
if (string.IsNullOrEmpty(headerTag))
|
||||
{
|
||||
headerTag = viewContext.ValidationSummaryMessageElement;
|
||||
}
|
||||
var messageTag = new TagBuilder(headerTag, _htmlEncoder);
|
||||
var messageTag = new TagBuilder(headerTag);
|
||||
messageTag.SetInnerText(message);
|
||||
wrappedMessage = messageTag.ToString(TagRenderMode.Normal) + Environment.NewLine;
|
||||
wrappedMessage.AppendLine(messageTag.ToHtmlContent(TagRenderMode.Normal));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -678,7 +682,8 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
|
||||
// If excludePropertyErrors is true, describe any validation issue with the current model in a single item.
|
||||
// Otherwise, list individual property errors.
|
||||
var htmlSummary = new StringBuilder();
|
||||
var htmlSummary = new BufferedHtmlContent();
|
||||
var isHtmlSummaryModified = false;
|
||||
var modelStates = ValidationHelpers.GetModelStateList(viewContext.ViewData, excludePropertyErrors);
|
||||
|
||||
foreach (var modelState in modelStates)
|
||||
|
|
@ -689,24 +694,25 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
|
||||
if (!string.IsNullOrEmpty(errorText))
|
||||
{
|
||||
var listItem = new TagBuilder("li", _htmlEncoder);
|
||||
var listItem = new TagBuilder("li");
|
||||
listItem.SetInnerText(errorText);
|
||||
htmlSummary.AppendLine(listItem.ToString(TagRenderMode.Normal));
|
||||
htmlSummary.AppendLine(listItem.ToHtmlContent(TagRenderMode.Normal));
|
||||
isHtmlSummaryModified = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (htmlSummary.Length == 0)
|
||||
if (!isHtmlSummaryModified)
|
||||
{
|
||||
htmlSummary.AppendLine(HiddenListItem);
|
||||
}
|
||||
|
||||
var unorderedList = new TagBuilder("ul", _htmlEncoder)
|
||||
var unorderedList = new TagBuilder("ul")
|
||||
{
|
||||
InnerHtml = htmlSummary.ToString()
|
||||
InnerHtml = htmlSummary
|
||||
};
|
||||
|
||||
var tagBuilder = new TagBuilder("div", _htmlEncoder);
|
||||
var tagBuilder = new TagBuilder("div");
|
||||
tagBuilder.MergeAttributes(GetHtmlAttributeDictionaryOrNull(htmlAttributes));
|
||||
|
||||
if (viewContext.ViewData.ModelState.IsValid)
|
||||
|
|
@ -718,7 +724,10 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
tagBuilder.AddCssClass(HtmlHelper.ValidationSummaryCssClassName);
|
||||
}
|
||||
|
||||
tagBuilder.InnerHtml = wrappedMessage + unorderedList.ToString(TagRenderMode.Normal);
|
||||
var innerContent = new BufferedHtmlContent();
|
||||
innerContent.Append(wrappedMessage);
|
||||
innerContent.Append(unorderedList.ToHtmlContent(TagRenderMode.Normal));
|
||||
tagBuilder.InnerHtml = innerContent;
|
||||
|
||||
if (formContext != null && !excludePropertyErrors)
|
||||
{
|
||||
|
|
@ -898,12 +907,10 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <remarks>
|
||||
/// Not used directly in HtmlHelper. Exposed for use in DefaultDisplayTemplates.
|
||||
/// </remarks>
|
||||
internal static TagBuilder GenerateOption(SelectListItem item, string encodedText, IHtmlEncoder htmlEncoder)
|
||||
internal static TagBuilder GenerateOption(SelectListItem item, string text)
|
||||
{
|
||||
var tagBuilder = new TagBuilder("option", htmlEncoder)
|
||||
{
|
||||
InnerHtml = encodedText,
|
||||
};
|
||||
var tagBuilder = new TagBuilder("option");
|
||||
tagBuilder.SetInnerText(text);
|
||||
|
||||
if (item.Value != null)
|
||||
{
|
||||
|
|
@ -959,7 +966,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
string method,
|
||||
object htmlAttributes)
|
||||
{
|
||||
var tagBuilder = new TagBuilder("form", _htmlEncoder);
|
||||
var tagBuilder = new TagBuilder("form");
|
||||
tagBuilder.MergeAttributes(GetHtmlAttributeDictionaryOrNull(htmlAttributes));
|
||||
|
||||
// action is implicitly generated from other parameters, so htmlAttributes take precedence.
|
||||
|
|
@ -1007,7 +1014,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
nameof(expression));
|
||||
}
|
||||
|
||||
var tagBuilder = new TagBuilder("input", _htmlEncoder);
|
||||
var tagBuilder = new TagBuilder("input");
|
||||
tagBuilder.MergeAttributes(htmlAttributes);
|
||||
tagBuilder.MergeAttribute("type", GetInputTypeString(inputType));
|
||||
tagBuilder.MergeAttribute("name", fullName, replaceExisting: true);
|
||||
|
|
@ -1108,9 +1115,9 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
[NotNull] string url,
|
||||
object htmlAttributes)
|
||||
{
|
||||
var tagBuilder = new TagBuilder("a", _htmlEncoder)
|
||||
var tagBuilder = new TagBuilder("a")
|
||||
{
|
||||
InnerHtml = _htmlEncoder.HtmlEncode(linkText),
|
||||
InnerHtml = new StringHtmlContent(linkText),
|
||||
};
|
||||
|
||||
tagBuilder.MergeAttributes(GetHtmlAttributeDictionaryOrNull(htmlAttributes));
|
||||
|
|
@ -1272,9 +1279,9 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
return newSelectList;
|
||||
}
|
||||
|
||||
private StringBuilder GenerateGroupsAndOptions(string optionLabel, IEnumerable<SelectListItem> selectList)
|
||||
private IHtmlContent GenerateGroupsAndOptions(string optionLabel, IEnumerable<SelectListItem> selectList)
|
||||
{
|
||||
var listItemBuilder = new StringBuilder();
|
||||
var listItemBuilder = new BufferedHtmlContent();
|
||||
|
||||
// Make optionLabel the first item that gets rendered.
|
||||
if (optionLabel != null)
|
||||
|
|
@ -1300,7 +1307,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
TagBuilder groupBuilder = null;
|
||||
if (optGroup != null)
|
||||
{
|
||||
groupBuilder = new TagBuilder("optgroup", _htmlEncoder);
|
||||
groupBuilder = new TagBuilder("optgroup");
|
||||
if (optGroup.Name != null)
|
||||
{
|
||||
groupBuilder.MergeAttribute("label", optGroup.Name);
|
||||
|
|
@ -1311,7 +1318,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
groupBuilder.MergeAttribute("disabled", "disabled");
|
||||
}
|
||||
|
||||
listItemBuilder.AppendLine(groupBuilder.ToString(TagRenderMode.StartTag));
|
||||
listItemBuilder.AppendLine(groupBuilder.ToHtmlContent(TagRenderMode.StartTag));
|
||||
}
|
||||
|
||||
foreach (var item in group)
|
||||
|
|
@ -1321,19 +1328,17 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
|
||||
if (optGroup != null)
|
||||
{
|
||||
listItemBuilder.AppendLine(groupBuilder.ToString(TagRenderMode.EndTag));
|
||||
listItemBuilder.AppendLine(groupBuilder.ToHtmlContent(TagRenderMode.EndTag));
|
||||
}
|
||||
}
|
||||
|
||||
return listItemBuilder;
|
||||
}
|
||||
|
||||
private string GenerateOption(SelectListItem item)
|
||||
private IHtmlContent GenerateOption(SelectListItem item)
|
||||
{
|
||||
var encodedText = Encode(item.Text);
|
||||
var tagBuilder = GenerateOption(item, encodedText, _htmlEncoder);
|
||||
|
||||
return tagBuilder.ToString(TagRenderMode.Normal);
|
||||
var tagBuilder = GenerateOption(item, item.Text);
|
||||
return tagBuilder.ToHtmlContent(TagRenderMode.Normal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
|
||||
private readonly IHtmlGenerator _htmlGenerator;
|
||||
private readonly ICompositeViewEngine _viewEngine;
|
||||
private readonly IHtmlEncoder _htmlEncoder;
|
||||
|
||||
private ViewContext _viewContext;
|
||||
|
||||
|
|
@ -48,8 +49,8 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
{
|
||||
_viewEngine = viewEngine;
|
||||
_htmlGenerator = htmlGenerator;
|
||||
_htmlEncoder = htmlEncoder;
|
||||
MetadataProvider = metadataProvider;
|
||||
HtmlEncoder = htmlEncoder;
|
||||
UrlEncoder = urlEncoder;
|
||||
JavaScriptStringEncoder = javaScriptStringEncoder;
|
||||
}
|
||||
|
|
@ -121,9 +122,6 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public IHtmlEncoder HtmlEncoder { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public IUrlEncoder UrlEncoder { get; }
|
||||
|
||||
|
|
@ -192,7 +190,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public HtmlString ActionLink(
|
||||
public IHtmlContent ActionLink(
|
||||
[NotNull] string linkText,
|
||||
string actionName,
|
||||
string controllerName,
|
||||
|
|
@ -216,11 +214,11 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
return HtmlString.Empty;
|
||||
}
|
||||
|
||||
return tagBuilder.ToHtmlString(TagRenderMode.Normal);
|
||||
return tagBuilder.ToHtmlContent(TagRenderMode.Normal);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public HtmlString AntiForgeryToken()
|
||||
public IHtmlContent AntiForgeryToken()
|
||||
{
|
||||
var html = _htmlGenerator.GenerateAntiforgery(ViewContext);
|
||||
return html ?? HtmlString.Empty;
|
||||
|
|
@ -251,7 +249,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public HtmlString CheckBox(string expression, bool? isChecked, object htmlAttributes)
|
||||
public IHtmlContent CheckBox(string expression, bool? isChecked, object htmlAttributes)
|
||||
{
|
||||
return GenerateCheckBox(
|
||||
modelExplorer: null,
|
||||
|
|
@ -285,7 +283,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public HtmlString Display(string expression,
|
||||
public IHtmlContent Display(string expression,
|
||||
string templateName,
|
||||
string htmlFieldName,
|
||||
object additionalViewData)
|
||||
|
|
@ -313,7 +311,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public HtmlString DropDownList(
|
||||
public IHtmlContent DropDownList(
|
||||
string expression,
|
||||
IEnumerable<SelectListItem> selectList,
|
||||
string optionLabel,
|
||||
|
|
@ -328,7 +326,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public HtmlString Editor(
|
||||
public IHtmlContent Editor(
|
||||
string expression,
|
||||
string templateName,
|
||||
string htmlFieldName,
|
||||
|
|
@ -377,7 +375,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public HtmlString Hidden(string expression, object value, object htmlAttributes)
|
||||
public IHtmlContent Hidden(string expression, object value, object htmlAttributes)
|
||||
{
|
||||
return GenerateHidden(
|
||||
modelExplorer: null,
|
||||
|
|
@ -394,7 +392,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public HtmlString Label(string expression, string labelText, object htmlAttributes)
|
||||
public IHtmlContent Label(string expression, string labelText, object htmlAttributes)
|
||||
{
|
||||
var modelExplorer = ExpressionMetadataProvider.FromStringExpression(expression, ViewData, MetadataProvider);
|
||||
return GenerateLabel(
|
||||
|
|
@ -405,7 +403,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public HtmlString ListBox(string expression, IEnumerable<SelectListItem> selectList, object htmlAttributes)
|
||||
public IHtmlContent ListBox(string expression, IEnumerable<SelectListItem> selectList, object htmlAttributes)
|
||||
{
|
||||
return GenerateListBox(
|
||||
modelExplorer: null,
|
||||
|
|
@ -439,7 +437,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
return RenderPartialCoreAsync(partialViewName, model, viewData, ViewContext.Writer);
|
||||
}
|
||||
|
||||
protected virtual HtmlString GenerateDisplay(ModelExplorer modelExplorer,
|
||||
protected virtual IHtmlContent GenerateDisplay(ModelExplorer modelExplorer,
|
||||
string htmlFieldName,
|
||||
string templateName,
|
||||
object additionalViewData)
|
||||
|
|
@ -453,9 +451,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
readOnly: true,
|
||||
additionalViewData: additionalViewData);
|
||||
|
||||
var templateResult = templateBuilder.Build();
|
||||
|
||||
return new HtmlString(templateResult);
|
||||
return templateBuilder.Build();
|
||||
}
|
||||
|
||||
protected virtual async Task RenderPartialCoreAsync([NotNull] string partialViewName,
|
||||
|
|
@ -491,7 +487,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public HtmlString Password(string expression, object value, object htmlAttributes)
|
||||
public IHtmlContent Password(string expression, object value, object htmlAttributes)
|
||||
{
|
||||
return GeneratePassword(
|
||||
modelExplorer: null,
|
||||
|
|
@ -501,7 +497,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public HtmlString RadioButton(string expression, object value, bool? isChecked, object htmlAttributes)
|
||||
public IHtmlContent RadioButton(string expression, object value, bool? isChecked, object htmlAttributes)
|
||||
{
|
||||
return GenerateRadioButton(
|
||||
modelExplorer: null,
|
||||
|
|
@ -512,19 +508,19 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public HtmlString Raw(string value)
|
||||
public IHtmlContent Raw(string value)
|
||||
{
|
||||
return new HtmlString(value);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public HtmlString Raw(object value)
|
||||
public IHtmlContent Raw(object value)
|
||||
{
|
||||
return new HtmlString(value == null ? null : value.ToString());
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public HtmlString RouteLink(
|
||||
public IHtmlContent RouteLink(
|
||||
[NotNull] string linkText,
|
||||
string routeName,
|
||||
string protocol,
|
||||
|
|
@ -546,17 +542,17 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
return HtmlString.Empty;
|
||||
}
|
||||
|
||||
return tagBuilder.ToHtmlString(TagRenderMode.Normal);
|
||||
return tagBuilder.ToHtmlContent(TagRenderMode.Normal);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public HtmlString ValidationMessage(string expression, string message, object htmlAttributes, string tag)
|
||||
public IHtmlContent ValidationMessage(string expression, string message, object htmlAttributes, string tag)
|
||||
{
|
||||
return GenerateValidationMessage(expression, message, htmlAttributes, tag);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public HtmlString ValidationSummary(
|
||||
public IHtmlContent ValidationSummary(
|
||||
bool excludePropertyErrors,
|
||||
string message,
|
||||
object htmlAttributes,
|
||||
|
|
@ -584,7 +580,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public HtmlString TextArea(string expression, string value, int rows, int columns, object htmlAttributes)
|
||||
public IHtmlContent TextArea(string expression, string value, int rows, int columns, object htmlAttributes)
|
||||
{
|
||||
var modelExplorer = ExpressionMetadataProvider.FromStringExpression(expression, ViewData, MetadataProvider);
|
||||
if (value != null)
|
||||
|
|
@ -606,7 +602,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public HtmlString TextBox(string expression, object value, string format, object htmlAttributes)
|
||||
public IHtmlContent TextBox(string expression, object value, string format, object htmlAttributes)
|
||||
{
|
||||
return GenerateTextBox(modelExplorer: null, expression: expression, value: value, format: format,
|
||||
htmlAttributes: htmlAttributes);
|
||||
|
|
@ -628,7 +624,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
return new MvcForm(ViewContext);
|
||||
}
|
||||
|
||||
protected virtual HtmlString GenerateCheckBox(
|
||||
protected virtual IHtmlContent GenerateCheckBox(
|
||||
ModelExplorer modelExplorer,
|
||||
string expression,
|
||||
bool? isChecked,
|
||||
|
|
@ -647,9 +643,11 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
return HtmlString.Empty;
|
||||
}
|
||||
|
||||
var elements = checkbox.ToString(TagRenderMode.SelfClosing) + hidden.ToString(TagRenderMode.SelfClosing);
|
||||
var elements = new BufferedHtmlContent();
|
||||
elements.Append(checkbox.ToHtmlContent(TagRenderMode.SelfClosing));
|
||||
elements.Append(hidden.ToHtmlContent(TagRenderMode.SelfClosing));
|
||||
|
||||
return new HtmlString(elements);
|
||||
return elements;
|
||||
}
|
||||
|
||||
protected virtual string GenerateDisplayName([NotNull] ModelExplorer modelExplorer, string expression)
|
||||
|
|
@ -672,7 +670,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
return modelExplorer.GetSimpleDisplayText() ?? string.Empty;
|
||||
}
|
||||
|
||||
protected HtmlString GenerateDropDown(
|
||||
protected IHtmlContent GenerateDropDown(
|
||||
ModelExplorer modelExplorer,
|
||||
string expression,
|
||||
IEnumerable<SelectListItem> selectList,
|
||||
|
|
@ -692,10 +690,10 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
return HtmlString.Empty;
|
||||
}
|
||||
|
||||
return tagBuilder.ToHtmlString(TagRenderMode.Normal);
|
||||
return tagBuilder.ToHtmlContent(TagRenderMode.Normal);
|
||||
}
|
||||
|
||||
protected virtual HtmlString GenerateEditor(
|
||||
protected virtual IHtmlContent GenerateEditor(
|
||||
ModelExplorer modelExplorer,
|
||||
string htmlFieldName,
|
||||
string templateName,
|
||||
|
|
@ -711,9 +709,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
readOnly: false,
|
||||
additionalViewData: additionalViewData);
|
||||
|
||||
var templateResult = templateBuilder.Build();
|
||||
|
||||
return new HtmlString(templateResult);
|
||||
return templateBuilder.Build();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -755,7 +751,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
htmlAttributes);
|
||||
if (tagBuilder != null)
|
||||
{
|
||||
ViewContext.Writer.Write(tagBuilder.ToString(TagRenderMode.StartTag));
|
||||
tagBuilder.ToHtmlContent(TagRenderMode.StartTag).WriteTo(ViewContext.Writer, _htmlEncoder);
|
||||
}
|
||||
|
||||
return CreateForm();
|
||||
|
|
@ -797,13 +793,13 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
htmlAttributes);
|
||||
if (tagBuilder != null)
|
||||
{
|
||||
ViewContext.Writer.Write(tagBuilder.ToString(TagRenderMode.StartTag));
|
||||
tagBuilder.ToHtmlContent(TagRenderMode.StartTag).WriteTo(ViewContext.Writer, _htmlEncoder);
|
||||
}
|
||||
|
||||
return CreateForm();
|
||||
}
|
||||
|
||||
protected virtual HtmlString GenerateHidden(
|
||||
protected virtual IHtmlContent GenerateHidden(
|
||||
ModelExplorer modelExplorer,
|
||||
string expression,
|
||||
object value,
|
||||
|
|
@ -823,7 +819,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
return HtmlString.Empty;
|
||||
}
|
||||
|
||||
return tagBuilder.ToHtmlString(TagRenderMode.SelfClosing);
|
||||
return tagBuilder.ToHtmlContent(TagRenderMode.SelfClosing);
|
||||
}
|
||||
|
||||
protected virtual string GenerateId(string expression)
|
||||
|
|
@ -834,7 +830,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
return id;
|
||||
}
|
||||
|
||||
protected virtual HtmlString GenerateLabel(
|
||||
protected virtual IHtmlContent GenerateLabel(
|
||||
[NotNull] ModelExplorer modelExplorer,
|
||||
string expression,
|
||||
string labelText,
|
||||
|
|
@ -851,10 +847,10 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
return HtmlString.Empty;
|
||||
}
|
||||
|
||||
return tagBuilder.ToHtmlString(TagRenderMode.Normal);
|
||||
return tagBuilder.ToHtmlContent(TagRenderMode.Normal);
|
||||
}
|
||||
|
||||
protected HtmlString GenerateListBox(
|
||||
protected IHtmlContent GenerateListBox(
|
||||
ModelExplorer modelExplorer,
|
||||
string expression,
|
||||
IEnumerable<SelectListItem> selectList,
|
||||
|
|
@ -873,7 +869,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
return HtmlString.Empty;
|
||||
}
|
||||
|
||||
return tagBuilder.ToHtmlString(TagRenderMode.Normal);
|
||||
return tagBuilder.ToHtmlContent(TagRenderMode.Normal);
|
||||
}
|
||||
|
||||
protected virtual string GenerateName(string expression)
|
||||
|
|
@ -882,7 +878,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
return fullName;
|
||||
}
|
||||
|
||||
protected virtual HtmlString GeneratePassword(
|
||||
protected virtual IHtmlContent GeneratePassword(
|
||||
ModelExplorer modelExplorer,
|
||||
string expression,
|
||||
object value,
|
||||
|
|
@ -899,10 +895,10 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
return HtmlString.Empty;
|
||||
}
|
||||
|
||||
return tagBuilder.ToHtmlString(TagRenderMode.SelfClosing);
|
||||
return tagBuilder.ToHtmlContent(TagRenderMode.SelfClosing);
|
||||
}
|
||||
|
||||
protected virtual HtmlString GenerateRadioButton(
|
||||
protected virtual IHtmlContent GenerateRadioButton(
|
||||
ModelExplorer modelExplorer,
|
||||
string expression,
|
||||
object value,
|
||||
|
|
@ -921,10 +917,10 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
return HtmlString.Empty;
|
||||
}
|
||||
|
||||
return tagBuilder.ToHtmlString(TagRenderMode.SelfClosing);
|
||||
return tagBuilder.ToHtmlContent(TagRenderMode.SelfClosing);
|
||||
}
|
||||
|
||||
protected virtual HtmlString GenerateTextArea(
|
||||
protected virtual IHtmlContent GenerateTextArea(
|
||||
ModelExplorer modelExplorer,
|
||||
string expression,
|
||||
int rows,
|
||||
|
|
@ -943,10 +939,10 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
return HtmlString.Empty;
|
||||
}
|
||||
|
||||
return tagBuilder.ToHtmlString(TagRenderMode.Normal);
|
||||
return tagBuilder.ToHtmlContent(TagRenderMode.Normal);
|
||||
}
|
||||
|
||||
protected virtual HtmlString GenerateTextBox(
|
||||
protected virtual IHtmlContent GenerateTextBox(
|
||||
ModelExplorer modelExplorer,
|
||||
string expression,
|
||||
object value,
|
||||
|
|
@ -965,10 +961,10 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
return HtmlString.Empty;
|
||||
}
|
||||
|
||||
return tagBuilder.ToHtmlString(TagRenderMode.SelfClosing);
|
||||
return tagBuilder.ToHtmlContent(TagRenderMode.SelfClosing);
|
||||
}
|
||||
|
||||
protected virtual HtmlString GenerateValidationMessage(
|
||||
protected virtual IHtmlContent GenerateValidationMessage(
|
||||
string expression,
|
||||
string message,
|
||||
object htmlAttributes,
|
||||
|
|
@ -985,10 +981,10 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
return HtmlString.Empty;
|
||||
}
|
||||
|
||||
return tagBuilder.ToHtmlString(TagRenderMode.Normal);
|
||||
return tagBuilder.ToHtmlContent(TagRenderMode.Normal);
|
||||
}
|
||||
|
||||
protected virtual HtmlString GenerateValidationSummary(
|
||||
protected virtual IHtmlContent GenerateValidationSummary(
|
||||
bool excludePropertyErrors,
|
||||
string message,
|
||||
object htmlAttributes,
|
||||
|
|
@ -1005,7 +1001,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
return HtmlString.Empty;
|
||||
}
|
||||
|
||||
return tagBuilder.ToHtmlString(TagRenderMode.Normal);
|
||||
return tagBuilder.ToHtmlContent(TagRenderMode.Normal);
|
||||
}
|
||||
|
||||
protected virtual string GenerateValue(string expression, object value, string format, bool useViewData)
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq.Expressions;
|
||||
using Microsoft.AspNet.Html.Abstractions;
|
||||
using Microsoft.AspNet.Mvc.ModelBinding;
|
||||
using Microsoft.AspNet.Mvc.Rendering.Expressions;
|
||||
using Microsoft.AspNet.Mvc.ViewFeatures;
|
||||
|
|
@ -56,7 +57,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public HtmlString CheckBoxFor(
|
||||
public IHtmlContent CheckBoxFor(
|
||||
[NotNull] Expression<Func<TModel, bool>> expression,
|
||||
object htmlAttributes)
|
||||
{
|
||||
|
|
@ -66,7 +67,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public HtmlString DropDownListFor<TResult>(
|
||||
public IHtmlContent DropDownListFor<TResult>(
|
||||
[NotNull] Expression<Func<TModel, TResult>> expression,
|
||||
IEnumerable<SelectListItem> selectList,
|
||||
string optionLabel,
|
||||
|
|
@ -79,7 +80,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public HtmlString DisplayFor<TResult>(
|
||||
public IHtmlContent DisplayFor<TResult>(
|
||||
[NotNull] Expression<Func<TModel, TResult>> expression,
|
||||
string templateName,
|
||||
string htmlFieldName,
|
||||
|
|
@ -127,7 +128,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public HtmlString EditorFor<TResult>(
|
||||
public IHtmlContent EditorFor<TResult>(
|
||||
[NotNull] Expression<Func<TModel, TResult>> expression,
|
||||
string templateName,
|
||||
string htmlFieldName,
|
||||
|
|
@ -143,7 +144,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public HtmlString HiddenFor<TResult>(
|
||||
public IHtmlContent HiddenFor<TResult>(
|
||||
[NotNull] Expression<Func<TModel, TResult>> expression,
|
||||
object htmlAttributes)
|
||||
{
|
||||
|
|
@ -163,7 +164,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public HtmlString LabelFor<TResult>(
|
||||
public IHtmlContent LabelFor<TResult>(
|
||||
[NotNull] Expression<Func<TModel, TResult>> expression,
|
||||
string labelText,
|
||||
object htmlAttributes)
|
||||
|
|
@ -177,7 +178,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public HtmlString ListBoxFor<TResult>(
|
||||
public IHtmlContent ListBoxFor<TResult>(
|
||||
[NotNull] Expression<Func<TModel, TResult>> expression,
|
||||
IEnumerable<SelectListItem> selectList,
|
||||
object htmlAttributes)
|
||||
|
|
@ -196,7 +197,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public HtmlString PasswordFor<TResult>(
|
||||
public IHtmlContent PasswordFor<TResult>(
|
||||
[NotNull] Expression<Func<TModel, TResult>> expression,
|
||||
object htmlAttributes)
|
||||
{
|
||||
|
|
@ -209,7 +210,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public HtmlString RadioButtonFor<TResult>(
|
||||
public IHtmlContent RadioButtonFor<TResult>(
|
||||
[NotNull] Expression<Func<TModel, TResult>> expression,
|
||||
[NotNull] object value,
|
||||
object htmlAttributes)
|
||||
|
|
@ -224,7 +225,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public HtmlString TextAreaFor<TResult>(
|
||||
public IHtmlContent TextAreaFor<TResult>(
|
||||
[NotNull] Expression<Func<TModel, TResult>> expression,
|
||||
int rows,
|
||||
int columns,
|
||||
|
|
@ -235,7 +236,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public HtmlString TextBoxFor<TResult>(
|
||||
public IHtmlContent TextBoxFor<TResult>(
|
||||
[NotNull] Expression<Func<TModel, TResult>> expression,
|
||||
string format,
|
||||
object htmlAttributes)
|
||||
|
|
@ -267,7 +268,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public HtmlString ValidationMessageFor<TResult>(
|
||||
public IHtmlContent ValidationMessageFor<TResult>(
|
||||
[NotNull] Expression<Func<TModel, TResult>> expression,
|
||||
string message,
|
||||
object htmlAttributes,
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.AspNet.Html.Abstractions;
|
||||
using Microsoft.AspNet.Mvc.ModelBinding;
|
||||
using Microsoft.AspNet.Mvc.ModelBinding.Validation;
|
||||
using Microsoft.Framework.Internal;
|
||||
|
|
@ -35,8 +36,8 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// Genrate an <input type="hidden".../> element containing an antiforgery token.
|
||||
/// </summary>
|
||||
/// <param name="viewContext">The <see cref="ViewContext"/> instance for the current scope.</param>
|
||||
/// <returns>An <see cref="HtmlString"/> instance for the <input type="hidden".../> element.</returns>
|
||||
HtmlString GenerateAntiforgery([NotNull] ViewContext viewContext);
|
||||
/// <returns>An <see cref="IHtmlContent"/> instance for the <input type="hidden".../> element.</returns>
|
||||
IHtmlContent GenerateAntiforgery([NotNull] ViewContext viewContext);
|
||||
|
||||
/// <summary>
|
||||
/// Generate a <input type="checkbox".../> element.
|
||||
|
|
|
|||
|
|
@ -6,23 +6,15 @@ using System.Collections.Generic;
|
|||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Microsoft.AspNet.Html.Abstractions;
|
||||
using Microsoft.AspNet.Mvc.ViewFeatures;
|
||||
using Microsoft.Framework.Internal;
|
||||
using Microsoft.Framework.WebEncoders;
|
||||
|
||||
namespace Microsoft.AspNet.Mvc.Rendering
|
||||
{
|
||||
public class TagBuilder
|
||||
{
|
||||
private string _innerHtml;
|
||||
private readonly IHtmlEncoder _htmlEncoder;
|
||||
|
||||
public TagBuilder(string tagName)
|
||||
: this(tagName, HtmlEncoder.Default)
|
||||
{
|
||||
}
|
||||
|
||||
public TagBuilder(string tagName, [NotNull] IHtmlEncoder htmlEncoder)
|
||||
{
|
||||
if (string.IsNullOrEmpty(tagName))
|
||||
{
|
||||
|
|
@ -31,16 +23,11 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
|
||||
TagName = tagName;
|
||||
Attributes = new SortedDictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
_htmlEncoder = htmlEncoder;
|
||||
}
|
||||
|
||||
public IDictionary<string, string> Attributes { get; private set; }
|
||||
|
||||
public string InnerHtml
|
||||
{
|
||||
get { return _innerHtml ?? string.Empty; }
|
||||
set { _innerHtml = value; }
|
||||
}
|
||||
public IHtmlContent InnerHtml { get; [param: NotNull] set; } = HtmlString.Empty;
|
||||
|
||||
public string TagName { get; private set; }
|
||||
|
||||
|
|
@ -138,7 +125,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
}
|
||||
}
|
||||
|
||||
private void AppendAttributes(TextWriter textWriter)
|
||||
private void AppendAttributes(BufferedHtmlContent content)
|
||||
{
|
||||
foreach (var attribute in Attributes)
|
||||
{
|
||||
|
|
@ -149,11 +136,11 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
continue;
|
||||
}
|
||||
|
||||
textWriter.Write(' ');
|
||||
textWriter.Write(key);
|
||||
textWriter.Write("=\"");
|
||||
_htmlEncoder.HtmlEncode(attribute.Value, textWriter);
|
||||
textWriter.Write('"');
|
||||
content.Append(" ");
|
||||
content.Append(key);
|
||||
content.Append("=\"");
|
||||
content.Append(new StringHtmlContent(attribute.Value));
|
||||
content.Append("\"");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -195,56 +182,51 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
|
||||
public void SetInnerText(string innerText)
|
||||
{
|
||||
InnerHtml = _htmlEncoder.HtmlEncode(innerText);
|
||||
InnerHtml = new StringHtmlContent(innerText);
|
||||
}
|
||||
|
||||
public HtmlString ToHtmlString(TagRenderMode renderMode)
|
||||
/// <summary>
|
||||
/// Converts the <see cref="TagBuilder"/> to <see cref="IHtmlContent"/> with the specified
|
||||
/// <see cref="TagRenderMode"/>.
|
||||
/// </summary>
|
||||
/// <param name="renderMode"><see cref="TagRenderMode"/> with which the <see cref="TagBuilder"/>
|
||||
/// should be written.</param>
|
||||
/// <returns><see cref="IHtmlContent"/> containing the contents of the <see cref="TagBuilder"/>.</returns>
|
||||
public IHtmlContent ToHtmlContent(TagRenderMode renderMode)
|
||||
{
|
||||
return new HtmlString(ToString(renderMode));
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return ToString(TagRenderMode.Normal);
|
||||
}
|
||||
|
||||
public string ToString(TagRenderMode renderMode)
|
||||
{
|
||||
using (var stringWriter = new StringWriter())
|
||||
var content = new BufferedHtmlContent();
|
||||
switch (renderMode)
|
||||
{
|
||||
switch (renderMode)
|
||||
{
|
||||
case TagRenderMode.StartTag:
|
||||
stringWriter.Write('<');
|
||||
stringWriter.Write(TagName);
|
||||
AppendAttributes(stringWriter);
|
||||
stringWriter.Write('>');
|
||||
break;
|
||||
case TagRenderMode.EndTag:
|
||||
stringWriter.Write("</");
|
||||
stringWriter.Write(TagName);
|
||||
stringWriter.Write('>');
|
||||
break;
|
||||
case TagRenderMode.SelfClosing:
|
||||
stringWriter.Write('<');
|
||||
stringWriter.Write(TagName);
|
||||
AppendAttributes(stringWriter);
|
||||
stringWriter.Write(" />");
|
||||
break;
|
||||
default:
|
||||
stringWriter.Write('<');
|
||||
stringWriter.Write(TagName);
|
||||
AppendAttributes(stringWriter);
|
||||
stringWriter.Write('>');
|
||||
stringWriter.Write(InnerHtml);
|
||||
stringWriter.Write("</");
|
||||
stringWriter.Write(TagName);
|
||||
stringWriter.Write('>');
|
||||
break;
|
||||
}
|
||||
|
||||
return stringWriter.ToString();
|
||||
case TagRenderMode.StartTag:
|
||||
content.Append("<");
|
||||
content.Append(TagName);
|
||||
AppendAttributes(content);
|
||||
content.Append(">");
|
||||
break;
|
||||
case TagRenderMode.EndTag:
|
||||
content.Append("</");
|
||||
content.Append(TagName);
|
||||
content.Append(">");
|
||||
break;
|
||||
case TagRenderMode.SelfClosing:
|
||||
content.Append("<");
|
||||
content.Append(TagName);
|
||||
AppendAttributes(content);
|
||||
content.Append(" />");
|
||||
break;
|
||||
default:
|
||||
content.Append("<");
|
||||
content.Append(TagName);
|
||||
AppendAttributes(content);
|
||||
content.Append(">");
|
||||
content.Append(InnerHtml);
|
||||
content.Append("</");
|
||||
content.Append(TagName);
|
||||
content.Append(">");
|
||||
break;
|
||||
}
|
||||
|
||||
return content;
|
||||
}
|
||||
|
||||
private static class Html401IdUtil
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
using System;
|
||||
using System.Linq.Expressions;
|
||||
using Microsoft.AspNet.Html.Abstractions;
|
||||
using Microsoft.Framework.Internal;
|
||||
|
||||
namespace Microsoft.AspNet.Mvc.Rendering
|
||||
|
|
@ -21,7 +22,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// Expression name, relative to the current model. May identify a single property or an
|
||||
/// <see cref="object"/> that contains the properties to display.
|
||||
/// </param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the created HTML.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the created HTML.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// For example the default <see cref="object"/> display template includes markup for each property in the
|
||||
|
|
@ -36,7 +37,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// case-sensitive file systems.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static HtmlString Display([NotNull] this IHtmlHelper htmlHelper, string expression)
|
||||
public static IHtmlContent Display([NotNull] this IHtmlHelper htmlHelper, string expression)
|
||||
{
|
||||
return htmlHelper.Display(expression, templateName: null, htmlFieldName: null, additionalViewData: null);
|
||||
}
|
||||
|
|
@ -56,7 +57,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// that can contain additional view data that will be merged into the <see cref="ViewDataDictionary{TModel}"/>
|
||||
/// instance created for the template.
|
||||
/// </param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the created HTML.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the created HTML.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// For example the default <see cref="object"/> display template includes markup for each property in the
|
||||
|
|
@ -71,7 +72,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// case-sensitive file systems.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static HtmlString Display(
|
||||
public static IHtmlContent Display(
|
||||
[NotNull] this IHtmlHelper htmlHelper,
|
||||
string expression,
|
||||
object additionalViewData)
|
||||
|
|
@ -94,7 +95,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <see cref="object"/> that contains the properties to display.
|
||||
/// </param>
|
||||
/// <param name="templateName">The name of the template used to create the HTML markup.</param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the created HTML.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the created HTML.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// For example the default <see cref="object"/> display template includes markup for each property in the
|
||||
|
|
@ -109,7 +110,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// case-sensitive file systems.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static HtmlString Display(
|
||||
public static IHtmlContent Display(
|
||||
[NotNull] this IHtmlHelper htmlHelper,
|
||||
string expression,
|
||||
string templateName)
|
||||
|
|
@ -133,7 +134,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// that can contain additional view data that will be merged into the <see cref="ViewDataDictionary{TModel}"/>
|
||||
/// instance created for the template.
|
||||
/// </param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the created HTML.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the created HTML.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// For example the default <see cref="object"/> display template includes markup for each property in the
|
||||
|
|
@ -148,7 +149,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// case-sensitive file systems.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static HtmlString Display(
|
||||
public static IHtmlContent Display(
|
||||
[NotNull] this IHtmlHelper htmlHelper,
|
||||
string expression,
|
||||
string templateName,
|
||||
|
|
@ -176,7 +177,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// A <see cref="string"/> used to disambiguate the names of HTML elements that are created for
|
||||
/// properties that have the same name.
|
||||
/// </param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the created HTML.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the created HTML.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// For example the default <see cref="object"/> display template includes markup for each property in the
|
||||
|
|
@ -191,7 +192,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// case-sensitive file systems.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static HtmlString Display(
|
||||
public static IHtmlContent Display(
|
||||
[NotNull] this IHtmlHelper htmlHelper,
|
||||
string expression,
|
||||
string templateName,
|
||||
|
|
@ -208,7 +209,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <param name="expression">An expression to be evaluated against the current model.</param>
|
||||
/// <typeparam name="TModel">The type of the model.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the <paramref name="expression"/> result.</typeparam>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the created HTML.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the created HTML.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// For example the default <see cref="object"/> display template includes markup for each property in the
|
||||
|
|
@ -219,7 +220,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// case-sensitive file systems.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static HtmlString DisplayFor<TModel, TResult>(
|
||||
public static IHtmlContent DisplayFor<TModel, TResult>(
|
||||
[NotNull] this IHtmlHelper<TModel> htmlHelper,
|
||||
[NotNull] Expression<Func<TModel, TResult>> expression)
|
||||
{
|
||||
|
|
@ -244,7 +245,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// </param>
|
||||
/// <typeparam name="TModel">The type of the model.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the <paramref name="expression"/> result.</typeparam>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the created HTML.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the created HTML.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// For example the default <see cref="object"/> display template includes markup for each property in the
|
||||
|
|
@ -255,7 +256,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// case-sensitive file systems.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static HtmlString DisplayFor<TModel, TResult>(
|
||||
public static IHtmlContent DisplayFor<TModel, TResult>(
|
||||
[NotNull] this IHtmlHelper<TModel> htmlHelper,
|
||||
[NotNull] Expression<Func<TModel, TResult>> expression,
|
||||
object additionalViewData)
|
||||
|
|
@ -277,7 +278,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <param name="templateName">The name of the template used to create the HTML markup.</param>
|
||||
/// <typeparam name="TModel">The type of the model.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the <paramref name="expression"/> result.</typeparam>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the created HTML.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the created HTML.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// For example the default <see cref="object"/> display template includes markup for each property in the
|
||||
|
|
@ -288,7 +289,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// case-sensitive file systems.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static HtmlString DisplayFor<TModel, TResult>(
|
||||
public static IHtmlContent DisplayFor<TModel, TResult>(
|
||||
[NotNull] this IHtmlHelper<TModel> htmlHelper,
|
||||
[NotNull] Expression<Func<TModel, TResult>> expression,
|
||||
string templateName)
|
||||
|
|
@ -315,7 +316,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// </param>
|
||||
/// <typeparam name="TModel">The type of the model.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the <paramref name="expression"/> result.</typeparam>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the created HTML.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the created HTML.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// For example the default <see cref="object"/> display template includes markup for each property in the
|
||||
|
|
@ -326,7 +327,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// case-sensitive file systems.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static HtmlString DisplayFor<TModel, TResult>(
|
||||
public static IHtmlContent DisplayFor<TModel, TResult>(
|
||||
[NotNull] this IHtmlHelper<TModel> htmlHelper,
|
||||
[NotNull] Expression<Func<TModel, TResult>> expression,
|
||||
string templateName,
|
||||
|
|
@ -353,7 +354,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// </param>
|
||||
/// <typeparam name="TModel">The type of the model.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the <paramref name="expression"/> result.</typeparam>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the created HTML.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the created HTML.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// For example the default <see cref="object"/> display template includes markup for each property in the
|
||||
|
|
@ -364,7 +365,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// case-sensitive file systems.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static HtmlString DisplayFor<TModel, TResult>(
|
||||
public static IHtmlContent DisplayFor<TModel, TResult>(
|
||||
[NotNull] this IHtmlHelper<TModel> htmlHelper,
|
||||
[NotNull] Expression<Func<TModel, TResult>> expression,
|
||||
string templateName,
|
||||
|
|
@ -382,7 +383,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// model's <see cref="ModelBinding.ModelMetadata"/>.
|
||||
/// </summary>
|
||||
/// <param name="htmlHelper">The <see cref="IHtmlHelper"/> instance this method extends.</param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the created HTML.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the created HTML.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// For example the default <see cref="object"/> display template includes markup for each property in the
|
||||
|
|
@ -393,7 +394,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// case-sensitive file systems.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static HtmlString DisplayForModel([NotNull] this IHtmlHelper htmlHelper)
|
||||
public static IHtmlContent DisplayForModel([NotNull] this IHtmlHelper htmlHelper)
|
||||
{
|
||||
return htmlHelper.Display(
|
||||
expression: null,
|
||||
|
|
@ -412,7 +413,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// that can contain additional view data that will be merged into the <see cref="ViewDataDictionary{TModel}"/>
|
||||
/// instance created for the template.
|
||||
/// </param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the created HTML.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the created HTML.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// For example the default <see cref="object"/> display template includes markup for each property in the
|
||||
|
|
@ -423,7 +424,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// case-sensitive file systems.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static HtmlString DisplayForModel([NotNull] this IHtmlHelper htmlHelper, object additionalViewData)
|
||||
public static IHtmlContent DisplayForModel([NotNull] this IHtmlHelper htmlHelper, object additionalViewData)
|
||||
{
|
||||
return htmlHelper.Display(
|
||||
expression: null,
|
||||
|
|
@ -438,7 +439,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// </summary>
|
||||
/// <param name="htmlHelper">The <see cref="IHtmlHelper"/> instance this method extends.</param>
|
||||
/// <param name="templateName">The name of the template used to create the HTML markup.</param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the created HTML.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the created HTML.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// For example the default <see cref="object"/> display template includes markup for each property in the
|
||||
|
|
@ -449,7 +450,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// case-sensitive file systems.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static HtmlString DisplayForModel([NotNull] this IHtmlHelper htmlHelper, string templateName)
|
||||
public static IHtmlContent DisplayForModel([NotNull] this IHtmlHelper htmlHelper, string templateName)
|
||||
{
|
||||
return htmlHelper.Display(
|
||||
expression: null,
|
||||
|
|
@ -470,7 +471,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// that can contain additional view data that will be merged into the <see cref="ViewDataDictionary{TModel}"/>
|
||||
/// instance created for the template.
|
||||
/// </param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the created HTML.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the created HTML.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// For example the default <see cref="object"/> display template includes markup for each property in the
|
||||
|
|
@ -481,7 +482,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// case-sensitive file systems.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static HtmlString DisplayForModel(
|
||||
public static IHtmlContent DisplayForModel(
|
||||
[NotNull] this IHtmlHelper htmlHelper,
|
||||
string templateName,
|
||||
object additionalViewData)
|
||||
|
|
@ -504,7 +505,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// A <see cref="string"/> used to disambiguate the names of HTML elements that are created for
|
||||
/// properties that have the same name.
|
||||
/// </param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the created HTML.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the created HTML.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// For example the default <see cref="object"/> display template includes markup for each property in the
|
||||
|
|
@ -515,7 +516,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// case-sensitive file systems.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static HtmlString DisplayForModel(
|
||||
public static IHtmlContent DisplayForModel(
|
||||
[NotNull] this IHtmlHelper htmlHelper,
|
||||
string templateName,
|
||||
string htmlFieldName)
|
||||
|
|
@ -543,7 +544,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// that can contain additional view data that will be merged into the <see cref="ViewDataDictionary{TModel}"/>
|
||||
/// instance created for the template.
|
||||
/// </param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the created HTML.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the created HTML.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// For example the default <see cref="object"/> display template includes markup for each property in the
|
||||
|
|
@ -554,7 +555,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// case-sensitive file systems.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static HtmlString DisplayForModel(
|
||||
public static IHtmlContent DisplayForModel(
|
||||
[NotNull] this IHtmlHelper htmlHelper,
|
||||
string templateName,
|
||||
string htmlFieldName,
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
using System;
|
||||
using System.Linq.Expressions;
|
||||
using Microsoft.AspNet.Html.Abstractions;
|
||||
using Microsoft.Framework.Internal;
|
||||
|
||||
namespace Microsoft.AspNet.Mvc.Rendering
|
||||
|
|
@ -21,7 +22,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// Expression name, relative to the current model. May identify a single property or an
|
||||
/// <see cref="object"/> that contains the properties to edit.
|
||||
/// </param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <input> element(s).</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <input> element(s).</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// For example the default <see cref="object"/> editor template includes <label> and <input>
|
||||
|
|
@ -36,7 +37,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// case-sensitive file systems.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static HtmlString Editor([NotNull] this IHtmlHelper htmlHelper, string expression)
|
||||
public static IHtmlContent Editor([NotNull] this IHtmlHelper htmlHelper, string expression)
|
||||
{
|
||||
return htmlHelper.Editor(expression, templateName: null, htmlFieldName: null, additionalViewData: null);
|
||||
}
|
||||
|
|
@ -56,7 +57,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// that can contain additional view data that will be merged into the <see cref="ViewDataDictionary{TModel}"/>
|
||||
/// instance created for the template.
|
||||
/// </param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <input> element(s).</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <input> element(s).</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// For example the default <see cref="object"/> editor template includes <label> and <input>
|
||||
|
|
@ -71,7 +72,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// case-sensitive file systems.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static HtmlString Editor(
|
||||
public static IHtmlContent Editor(
|
||||
[NotNull] this IHtmlHelper htmlHelper,
|
||||
string expression,
|
||||
object additionalViewData)
|
||||
|
|
@ -94,7 +95,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <see cref="object"/> that contains the properties to edit.
|
||||
/// </param>
|
||||
/// <param name="templateName">The name of the template used to create the HTML markup.</param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <input> element(s).</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <input> element(s).</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// For example the default <see cref="object"/> editor template includes <label> and <input>
|
||||
|
|
@ -109,7 +110,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// case-sensitive file systems.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static HtmlString Editor([NotNull] this IHtmlHelper htmlHelper, string expression, string templateName)
|
||||
public static IHtmlContent Editor([NotNull] this IHtmlHelper htmlHelper, string expression, string templateName)
|
||||
{
|
||||
return htmlHelper.Editor(expression, templateName, htmlFieldName: null, additionalViewData: null);
|
||||
}
|
||||
|
|
@ -130,7 +131,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// that can contain additional view data that will be merged into the <see cref="ViewDataDictionary{TModel}"/>
|
||||
/// instance created for the template.
|
||||
/// </param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <input> element(s).</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <input> element(s).</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// For example the default <see cref="object"/> editor template includes <label> and <input>
|
||||
|
|
@ -145,7 +146,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// case-sensitive file systems.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static HtmlString Editor(
|
||||
public static IHtmlContent Editor(
|
||||
[NotNull] this IHtmlHelper htmlHelper,
|
||||
string expression,
|
||||
string templateName,
|
||||
|
|
@ -173,7 +174,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// A <see cref="string"/> used to disambiguate the names of HTML elements that are created for
|
||||
/// properties that have the same name.
|
||||
/// </param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <input> element(s).</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <input> element(s).</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// For example the default <see cref="object"/> editor template includes <label> and <input>
|
||||
|
|
@ -188,7 +189,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// case-sensitive file systems.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static HtmlString Editor(
|
||||
public static IHtmlContent Editor(
|
||||
[NotNull] this IHtmlHelper htmlHelper,
|
||||
string expression,
|
||||
string templateName,
|
||||
|
|
@ -205,7 +206,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <param name="expression">An expression to be evaluated against the current model.</param>
|
||||
/// <typeparam name="TModel">The type of the model.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the <paramref name="expression"/> result.</typeparam>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <input> element(s).</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <input> element(s).</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// For example the default <see cref="object"/> editor template includes <label> and <input>
|
||||
|
|
@ -216,7 +217,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// case-sensitive file systems.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static HtmlString EditorFor<TModel, TResult>(
|
||||
public static IHtmlContent EditorFor<TModel, TResult>(
|
||||
[NotNull] this IHtmlHelper<TModel> htmlHelper,
|
||||
[NotNull] Expression<Func<TModel, TResult>> expression)
|
||||
{
|
||||
|
|
@ -237,7 +238,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// </param>
|
||||
/// <typeparam name="TModel">The type of the model.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the <paramref name="expression"/> result.</typeparam>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <input> element(s).</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <input> element(s).</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// For example the default <see cref="object"/> editor template includes <label> and <input>
|
||||
|
|
@ -248,7 +249,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// case-sensitive file systems.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static HtmlString EditorFor<TModel, TResult>(
|
||||
public static IHtmlContent EditorFor<TModel, TResult>(
|
||||
[NotNull] this IHtmlHelper<TModel> htmlHelper,
|
||||
[NotNull] Expression<Func<TModel, TResult>> expression,
|
||||
object additionalViewData)
|
||||
|
|
@ -270,7 +271,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <param name="templateName">The name of the template that is used to create the HTML markup.</param>
|
||||
/// <typeparam name="TModel">The type of the model.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the <paramref name="expression"/> result.</typeparam>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <input> element(s).</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <input> element(s).</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// For example the default <see cref="object"/> editor template includes <label> and <input>
|
||||
|
|
@ -281,7 +282,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// case-sensitive file systems.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static HtmlString EditorFor<TModel, TResult>(
|
||||
public static IHtmlContent EditorFor<TModel, TResult>(
|
||||
[NotNull] this IHtmlHelper<TModel> htmlHelper,
|
||||
[NotNull] Expression<Func<TModel, TResult>> expression,
|
||||
string templateName)
|
||||
|
|
@ -304,7 +305,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// </param>
|
||||
/// <typeparam name="TModel">The type of the model.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the <paramref name="expression"/> result.</typeparam>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <input> element(s).</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <input> element(s).</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// For example the default <see cref="object"/> editor template includes <label> and <input>
|
||||
|
|
@ -315,7 +316,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// case-sensitive file systems.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static HtmlString EditorFor<TModel, TResult>(
|
||||
public static IHtmlContent EditorFor<TModel, TResult>(
|
||||
[NotNull] this IHtmlHelper<TModel> htmlHelper,
|
||||
[NotNull] Expression<Func<TModel, TResult>> expression,
|
||||
string templateName,
|
||||
|
|
@ -342,7 +343,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// </param>
|
||||
/// <typeparam name="TModel">The type of the model.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the <paramref name="expression"/> result.</typeparam>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <input> element(s).</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <input> element(s).</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// For example the default <see cref="object"/> editor template includes <label> and <input>
|
||||
|
|
@ -353,7 +354,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// case-sensitive file systems.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static HtmlString EditorFor<TModel, TResult>(
|
||||
public static IHtmlContent EditorFor<TModel, TResult>(
|
||||
[NotNull] this IHtmlHelper<TModel> htmlHelper,
|
||||
[NotNull] Expression<Func<TModel, TResult>> expression,
|
||||
string templateName,
|
||||
|
|
@ -367,7 +368,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// model's <see cref="ModelBinding.ModelMetadata"/>.
|
||||
/// </summary>
|
||||
/// <param name="htmlHelper">The <see cref="IHtmlHelper"/> instance this method extends.</param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <input> element(s).</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <input> element(s).</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// For example the default <see cref="object"/> editor template includes <label> and <input>
|
||||
|
|
@ -378,7 +379,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// case-sensitive file systems.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static HtmlString EditorForModel([NotNull] this IHtmlHelper htmlHelper)
|
||||
public static IHtmlContent EditorForModel([NotNull] this IHtmlHelper htmlHelper)
|
||||
{
|
||||
return htmlHelper.Editor(
|
||||
expression: null,
|
||||
|
|
@ -397,7 +398,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// that can contain additional view data that will be merged into the <see cref="ViewDataDictionary{TModel}"/>
|
||||
/// instance created for the template.
|
||||
/// </param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <input> element(s).</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <input> element(s).</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// For example the default <see cref="object"/> editor template includes <label> and <input>
|
||||
|
|
@ -408,7 +409,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// case-sensitive file systems.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static HtmlString EditorForModel([NotNull] this IHtmlHelper htmlHelper, object additionalViewData)
|
||||
public static IHtmlContent EditorForModel([NotNull] this IHtmlHelper htmlHelper, object additionalViewData)
|
||||
{
|
||||
return htmlHelper.Editor(
|
||||
expression: null,
|
||||
|
|
@ -423,7 +424,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// </summary>
|
||||
/// <param name="htmlHelper">The <see cref="IHtmlHelper"/> instance this method extends.</param>
|
||||
/// <param name="templateName">The name of the template used to create the HTML markup.</param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <input> element(s).</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <input> element(s).</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// For example the default <see cref="object"/> editor template includes <label> and <input>
|
||||
|
|
@ -434,7 +435,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// case-sensitive file systems.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static HtmlString EditorForModel([NotNull] this IHtmlHelper htmlHelper, string templateName)
|
||||
public static IHtmlContent EditorForModel([NotNull] this IHtmlHelper htmlHelper, string templateName)
|
||||
{
|
||||
return htmlHelper.Editor(
|
||||
expression: null,
|
||||
|
|
@ -455,7 +456,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// that can contain additional view data that will be merged into the <see cref="ViewDataDictionary{TModel}"/>
|
||||
/// instance created for the template.
|
||||
/// </param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <input> element(s).</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <input> element(s).</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// For example the default <see cref="object"/> editor template includes <label> and <input>
|
||||
|
|
@ -466,7 +467,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// case-sensitive file systems.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static HtmlString EditorForModel(
|
||||
public static IHtmlContent EditorForModel(
|
||||
[NotNull] this IHtmlHelper htmlHelper,
|
||||
string templateName,
|
||||
object additionalViewData)
|
||||
|
|
@ -489,7 +490,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// A <see cref="string"/> used to disambiguate the names of HTML elements that are created for
|
||||
/// properties that have the same name.
|
||||
/// </param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <input> element(s).</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <input> element(s).</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// For example the default <see cref="object"/> editor template includes <label> and <input>
|
||||
|
|
@ -500,7 +501,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// case-sensitive file systems.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static HtmlString EditorForModel(
|
||||
public static IHtmlContent EditorForModel(
|
||||
[NotNull] this IHtmlHelper htmlHelper,
|
||||
string templateName,
|
||||
string htmlFieldName)
|
||||
|
|
@ -528,7 +529,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// that can contain additional view data that will be merged into the <see cref="ViewDataDictionary{TModel}"/>
|
||||
/// instance created for the template.
|
||||
/// </param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <input> element(s).</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <input> element(s).</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// For example the default <see cref="object"/> editor template includes <label> and <input>
|
||||
|
|
@ -539,7 +540,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// case-sensitive file systems.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static HtmlString EditorForModel(
|
||||
public static IHtmlContent EditorForModel(
|
||||
[NotNull] this IHtmlHelper htmlHelper,
|
||||
string templateName,
|
||||
string htmlFieldName,
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
using System;
|
||||
using System.Linq.Expressions;
|
||||
using Microsoft.AspNet.Html.Abstractions;
|
||||
using Microsoft.Framework.Internal;
|
||||
|
||||
namespace Microsoft.AspNet.Mvc.Rendering
|
||||
|
|
@ -18,7 +19,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// </summary>
|
||||
/// <param name="htmlHelper">The <see cref="IHtmlHelper"/> instance this method extends.</param>
|
||||
/// <param name="expression">Expression name, relative to the current model.</param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <input> elements.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <input> elements.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Combines <see cref="TemplateInfo.HtmlFieldPrefix"/> and <paramref name="expression"/> to set checkbox
|
||||
|
|
@ -48,7 +49,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// value "checked" if the <see cref="bool"/> values is <c>true</c>; does not include the attribute otherwise.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static HtmlString CheckBox([NotNull] this IHtmlHelper htmlHelper, string expression)
|
||||
public static IHtmlContent CheckBox([NotNull] this IHtmlHelper htmlHelper, string expression)
|
||||
{
|
||||
return htmlHelper.CheckBox(expression, isChecked: null, htmlAttributes: null);
|
||||
}
|
||||
|
|
@ -60,7 +61,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <param name="htmlHelper">The <see cref="IHtmlHelper"/> instance this method extends.</param>
|
||||
/// <param name="expression">Expression name, relative to the current model.</param>
|
||||
/// <param name="isChecked">If <c>true</c>, checkbox is initially checked.</param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <input> elements.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <input> elements.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Combines <see cref="TemplateInfo.HtmlFieldPrefix"/> and <paramref name="expression"/> to set checkbox
|
||||
|
|
@ -91,7 +92,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// value "checked" if the <see cref="bool"/> values is <c>true</c>; does not include the attribute otherwise.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static HtmlString CheckBox(
|
||||
public static IHtmlContent CheckBox(
|
||||
[NotNull] this IHtmlHelper htmlHelper,
|
||||
string expression,
|
||||
bool isChecked)
|
||||
|
|
@ -110,7 +111,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <see cref="System.Collections.Generic.IDictionary{string, object}"/> instance containing the HTML
|
||||
/// attributes.
|
||||
/// </param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <input> elements.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <input> elements.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Combines <see cref="TemplateInfo.HtmlFieldPrefix"/> and <paramref name="expression"/> to set checkbox
|
||||
|
|
@ -141,7 +142,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// value "checked" if the <see cref="bool"/> values is <c>true</c>; does not include the attribute otherwise.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static HtmlString CheckBox(
|
||||
public static IHtmlContent CheckBox(
|
||||
[NotNull] this IHtmlHelper htmlHelper,
|
||||
string expression,
|
||||
object htmlAttributes)
|
||||
|
|
@ -155,7 +156,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// </summary>
|
||||
/// <param name="htmlHelper">The <see cref="IHtmlHelper{TModel}"/> instance this method extends.</param>
|
||||
/// <param name="expression">An expression to be evaluated against the current model.</param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <input> elements.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <input> elements.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Combines <see cref="TemplateInfo.HtmlFieldPrefix"/> and the string representation of the
|
||||
|
|
@ -179,7 +180,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// value "checked" if the <see cref="bool"/> values is <c>true</c>; does not include the attribute otherwise.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static HtmlString CheckBoxFor<TModel>(
|
||||
public static IHtmlContent CheckBoxFor<TModel>(
|
||||
[NotNull] this IHtmlHelper<TModel> htmlHelper,
|
||||
[NotNull] Expression<Func<TModel, bool>> expression)
|
||||
{
|
||||
|
|
@ -191,7 +192,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// </summary>
|
||||
/// <param name="htmlHelper">The <see cref="IHtmlHelper"/> instance this method extends.</param>
|
||||
/// <param name="expression">Expression name, relative to the current model.</param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <input> element.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <input> element.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Combines <see cref="TemplateInfo.HtmlFieldPrefix"/> and <paramref name="expression"/> to set
|
||||
|
|
@ -217,7 +218,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <item>Otherwise, <c>string.Empty</c>.</item>
|
||||
/// </list>
|
||||
/// </remarks>
|
||||
public static HtmlString Hidden([NotNull] this IHtmlHelper htmlHelper, string expression)
|
||||
public static IHtmlContent Hidden([NotNull] this IHtmlHelper htmlHelper, string expression)
|
||||
{
|
||||
return htmlHelper.Hidden(expression, value: null, htmlAttributes: null);
|
||||
}
|
||||
|
|
@ -228,7 +229,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <param name="htmlHelper">The <see cref="IHtmlHelper"/> instance this method extends.</param>
|
||||
/// <param name="expression">Expression name, relative to the current model.</param>
|
||||
/// <param name="value">If non-<c>null</c>, value to include in the element.</param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <input> element.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <input> element.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Combines <see cref="TemplateInfo.HtmlFieldPrefix"/> and <paramref name="expression"/> to set
|
||||
|
|
@ -255,7 +256,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <item>Otherwise, <c>string.Empty</c>.</item>
|
||||
/// </list>
|
||||
/// </remarks>
|
||||
public static HtmlString Hidden(
|
||||
public static IHtmlContent Hidden(
|
||||
[NotNull] this IHtmlHelper htmlHelper,
|
||||
string expression,
|
||||
object value)
|
||||
|
|
@ -270,7 +271,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <param name="expression">An expression to be evaluated against the current model.</param>
|
||||
/// <typeparam name="TModel">The type of the model.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the <paramref name="expression"/> result.</typeparam>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <input> element.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <input> element.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Combines <see cref="TemplateInfo.HtmlFieldPrefix"/> and the string representation of the
|
||||
|
|
@ -290,7 +291,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <item>Otherwise, <c>string.Empty</c>.</item>
|
||||
/// </list>
|
||||
/// </remarks>
|
||||
public static HtmlString HiddenFor<TModel, TResult>(
|
||||
public static IHtmlContent HiddenFor<TModel, TResult>(
|
||||
[NotNull] this IHtmlHelper<TModel> htmlHelper,
|
||||
[NotNull] Expression<Func<TModel, TResult>> expression)
|
||||
{
|
||||
|
|
@ -302,13 +303,13 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// </summary>
|
||||
/// <param name="htmlHelper">The <see cref="IHtmlHelper"/> instance this method extends.</param>
|
||||
/// <param name="expression">Expression name, relative to the current model.</param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <input> element.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <input> element.</returns>
|
||||
/// <remarks>
|
||||
/// Combines <see cref="TemplateInfo.HtmlFieldPrefix"/> and <paramref name="expression"/> to set
|
||||
/// <input> element's "name" attribute. Sanitizes <paramref name="expression"/> to set element's "id"
|
||||
/// attribute. Sets <input> element's "value" attribute to <c>string.Empty</c>.
|
||||
/// </remarks>
|
||||
public static HtmlString Password([NotNull] this IHtmlHelper htmlHelper, string expression)
|
||||
public static IHtmlContent Password([NotNull] this IHtmlHelper htmlHelper, string expression)
|
||||
{
|
||||
return htmlHelper.Password(expression, value: null, htmlAttributes: null);
|
||||
}
|
||||
|
|
@ -319,7 +320,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <param name="htmlHelper">The <see cref="IHtmlHelper"/> instance this method extends.</param>
|
||||
/// <param name="expression">Expression name, relative to the current model.</param>
|
||||
/// <param name="value">If non-<c>null</c>, value to include in the element.</param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <input> element.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <input> element.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Combines <see cref="TemplateInfo.HtmlFieldPrefix"/> and <paramref name="expression"/> to set
|
||||
|
|
@ -332,7 +333,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <item>Otherwise, <c>string.Empty</c>.</item>
|
||||
/// </list>
|
||||
/// </remarks>
|
||||
public static HtmlString Password(
|
||||
public static IHtmlContent Password(
|
||||
[NotNull] this IHtmlHelper htmlHelper,
|
||||
string expression,
|
||||
object value)
|
||||
|
|
@ -347,7 +348,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <param name="expression">An expression to be evaluated against the current model.</param>
|
||||
/// <typeparam name="TModel">The type of the model.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the <paramref name="expression"/> result.</typeparam>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <input> element.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <input> element.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Combines <see cref="TemplateInfo.HtmlFieldPrefix"/> and the string representation of the
|
||||
|
|
@ -363,7 +364,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <item>Otherwise, <c>string.Empty</c>.</item>
|
||||
/// </list>
|
||||
/// </remarks>
|
||||
public static HtmlString PasswordFor<TModel, TResult>(
|
||||
public static IHtmlContent PasswordFor<TModel, TResult>(
|
||||
[NotNull] this IHtmlHelper<TModel> htmlHelper,
|
||||
[NotNull] Expression<Func<TModel, TResult>> expression)
|
||||
{
|
||||
|
|
@ -376,7 +377,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <param name="htmlHelper">The <see cref="IHtmlHelper"/> instance this method extends.</param>
|
||||
/// <param name="expression">Expression name, relative to the current model.</param>
|
||||
/// <param name="value">Value to include in the element. Must not be <c>null</c>.</param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <input> element.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <input> element.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Combines <see cref="TemplateInfo.HtmlFieldPrefix"/> and <paramref name="expression"/> to set
|
||||
|
|
@ -408,7 +409,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// the attribute otherwise.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static HtmlString RadioButton(
|
||||
public static IHtmlContent RadioButton(
|
||||
[NotNull] this IHtmlHelper htmlHelper,
|
||||
string expression,
|
||||
object value)
|
||||
|
|
@ -430,7 +431,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <see cref="System.Collections.Generic.IDictionary{string, object}"/> instance containing the HTML
|
||||
/// attributes.
|
||||
/// </param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <input> element.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <input> element.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Combines <see cref="TemplateInfo.HtmlFieldPrefix"/> and <paramref name="expression"/> to set
|
||||
|
|
@ -469,7 +470,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// the attribute otherwise.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static HtmlString RadioButton(
|
||||
public static IHtmlContent RadioButton(
|
||||
[NotNull] this IHtmlHelper htmlHelper,
|
||||
string expression,
|
||||
object value,
|
||||
|
|
@ -491,7 +492,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// If <c>true</c>, radio button is initially selected. Must not be <c>null</c> if
|
||||
/// <paramref name="value"/> is also <c>null</c>.
|
||||
/// </param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <input> element.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <input> element.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Combines <see cref="TemplateInfo.HtmlFieldPrefix"/> and <paramref name="expression"/> to set
|
||||
|
|
@ -529,7 +530,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// the attribute otherwise.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static HtmlString RadioButton(
|
||||
public static IHtmlContent RadioButton(
|
||||
[NotNull] this IHtmlHelper htmlHelper,
|
||||
string expression,
|
||||
object value,
|
||||
|
|
@ -546,7 +547,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <param name="value">Value to include in the element. Must not be <c>null</c>.</param>
|
||||
/// <typeparam name="TModel">The type of the model.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the <paramref name="expression"/> result.</typeparam>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <input> element.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <input> element.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Combines <see cref="TemplateInfo.HtmlFieldPrefix"/> and the string representation of the
|
||||
|
|
@ -571,7 +572,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <paramref name="value"/>; does not include the attribute otherwise.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public static HtmlString RadioButtonFor<TModel, TResult>(
|
||||
public static IHtmlContent RadioButtonFor<TModel, TResult>(
|
||||
[NotNull] this IHtmlHelper<TModel> htmlHelper,
|
||||
[NotNull] Expression<Func<TModel, TResult>> expression,
|
||||
[NotNull] object value)
|
||||
|
|
@ -584,7 +585,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// </summary>
|
||||
/// <param name="htmlHelper">The <see cref="IHtmlHelper"/> instance this method extends.</param>
|
||||
/// <param name="expression">Expression name, relative to the current model.</param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <input> element.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <input> element.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Combines <see cref="TemplateInfo.HtmlFieldPrefix"/> and <paramref name="expression"/> to set
|
||||
|
|
@ -610,7 +611,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <item>Otherwise, <c>string.Empty</c>.</item>
|
||||
/// </list>
|
||||
/// </remarks>
|
||||
public static HtmlString TextBox([NotNull] this IHtmlHelper htmlHelper, string expression)
|
||||
public static IHtmlContent TextBox([NotNull] this IHtmlHelper htmlHelper, string expression)
|
||||
{
|
||||
return htmlHelper.TextBox(expression, value: null, format: null, htmlAttributes: null);
|
||||
}
|
||||
|
|
@ -621,7 +622,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <param name="htmlHelper">The <see cref="IHtmlHelper"/> instance this method extends.</param>
|
||||
/// <param name="expression">Expression name, relative to the current model.</param>
|
||||
/// <param name="value">If non-<c>null</c>, value to include in the element.</param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <input> element.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <input> element.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Combines <see cref="TemplateInfo.HtmlFieldPrefix"/> and <paramref name="expression"/> to set
|
||||
|
|
@ -650,7 +651,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <item>Otherwise, <c>string.Empty</c>.</item>
|
||||
/// </list>
|
||||
/// </remarks>
|
||||
public static HtmlString TextBox(
|
||||
public static IHtmlContent TextBox(
|
||||
[NotNull] this IHtmlHelper htmlHelper,
|
||||
string expression,
|
||||
object value)
|
||||
|
|
@ -667,7 +668,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <param name="format">
|
||||
/// The composite format <see cref="string"/> (see http://msdn.microsoft.com/en-us/library/txafckwd.aspx).
|
||||
/// </param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <input> element.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <input> element.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Combines <see cref="TemplateInfo.HtmlFieldPrefix"/> and <paramref name="expression"/> to set
|
||||
|
|
@ -701,7 +702,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <item>Otherwise, <c>string.Empty</c>.</item>
|
||||
/// </list>
|
||||
/// </remarks>
|
||||
public static HtmlString TextBox(
|
||||
public static IHtmlContent TextBox(
|
||||
[NotNull] this IHtmlHelper htmlHelper,
|
||||
string expression,
|
||||
object value,
|
||||
|
|
@ -721,7 +722,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <see cref="System.Collections.Generic.IDictionary{string, object}"/> instance containing the HTML
|
||||
/// attributes.
|
||||
/// </param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <input> element.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <input> element.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Combines <see cref="TemplateInfo.HtmlFieldPrefix"/> and <paramref name="expression"/> to set
|
||||
|
|
@ -751,7 +752,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <item>Otherwise, <c>string.Empty</c>.</item>
|
||||
/// </list>
|
||||
/// </remarks>
|
||||
public static HtmlString TextBox(
|
||||
public static IHtmlContent TextBox(
|
||||
[NotNull] this IHtmlHelper htmlHelper,
|
||||
string expression,
|
||||
object value,
|
||||
|
|
@ -767,7 +768,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <param name="expression">An expression to be evaluated against the current model.</param>
|
||||
/// <typeparam name="TModel">The type of the model.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the <paramref name="expression"/> result.</typeparam>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <input> element.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <input> element.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Combines <see cref="TemplateInfo.HtmlFieldPrefix"/> and the string representation of the
|
||||
|
|
@ -786,7 +787,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <item>Otherwise, <c>string.Empty</c>.</item>
|
||||
/// </list>
|
||||
/// </remarks>
|
||||
public static HtmlString TextBoxFor<TModel, TResult>(
|
||||
public static IHtmlContent TextBoxFor<TModel, TResult>(
|
||||
[NotNull] this IHtmlHelper<TModel> htmlHelper,
|
||||
[NotNull] Expression<Func<TModel, TResult>> expression)
|
||||
{
|
||||
|
|
@ -803,7 +804,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// </param>
|
||||
/// <typeparam name="TModel">The type of the model.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the <paramref name="expression"/> result.</typeparam>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <input> element.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <input> element.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Combines <see cref="TemplateInfo.HtmlFieldPrefix"/> and the string representation of the
|
||||
|
|
@ -824,7 +825,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <item>Otherwise, <c>string.Empty</c>.</item>
|
||||
/// </list>
|
||||
/// </remarks>
|
||||
public static HtmlString TextBoxFor<TModel, TResult>(
|
||||
public static IHtmlContent TextBoxFor<TModel, TResult>(
|
||||
[NotNull] this IHtmlHelper<TModel> htmlHelper,
|
||||
[NotNull] Expression<Func<TModel, TResult>> expression,
|
||||
string format)
|
||||
|
|
@ -844,7 +845,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// </param>
|
||||
/// <typeparam name="TModel">The type of the model.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the <paramref name="expression"/> result.</typeparam>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <input> element.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <input> element.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Combines <see cref="TemplateInfo.HtmlFieldPrefix"/> and the string representation of the
|
||||
|
|
@ -864,7 +865,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <item>Otherwise, <c>string.Empty</c>.</item>
|
||||
/// </list>
|
||||
/// </remarks>
|
||||
public static HtmlString TextBoxFor<TModel, TResult>(
|
||||
public static IHtmlContent TextBoxFor<TModel, TResult>(
|
||||
[NotNull] this IHtmlHelper<TModel> htmlHelper,
|
||||
[NotNull] Expression<Func<TModel, TResult>> expression,
|
||||
object htmlAttributes)
|
||||
|
|
@ -877,7 +878,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// </summary>
|
||||
/// <param name="htmlHelper">The <see cref="IHtmlHelper"/> instance this method extends.</param>
|
||||
/// <param name="expression">Expression name, relative to the current model.</param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <textarea> element.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <textarea> element.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Combines <see cref="TemplateInfo.HtmlFieldPrefix"/> and <paramref name="expression"/> to set
|
||||
|
|
@ -903,7 +904,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <item>Otherwise, <c>string.Empty</c>.</item>
|
||||
/// </list>
|
||||
/// </remarks>
|
||||
public static HtmlString TextArea(
|
||||
public static IHtmlContent TextArea(
|
||||
[NotNull] this IHtmlHelper htmlHelper,
|
||||
string expression)
|
||||
{
|
||||
|
|
@ -920,7 +921,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <see cref="System.Collections.Generic.IDictionary{string, object}"/> instance containing the HTML
|
||||
/// attributes.
|
||||
/// </param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <textarea> element.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <textarea> element.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Combines <see cref="TemplateInfo.HtmlFieldPrefix"/> and <paramref name="expression"/> to set
|
||||
|
|
@ -946,7 +947,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <item>Otherwise, <c>string.Empty</c>.</item>
|
||||
/// </list>
|
||||
/// </remarks>
|
||||
public static HtmlString TextArea(
|
||||
public static IHtmlContent TextArea(
|
||||
[NotNull] this IHtmlHelper htmlHelper,
|
||||
string expression,
|
||||
object htmlAttributes)
|
||||
|
|
@ -960,7 +961,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <param name="htmlHelper">The <see cref="IHtmlHelper"/> instance this method extends.</param>
|
||||
/// <param name="expression">Expression name, relative to the current model.</param>
|
||||
/// <param name="value">If non-<c>null</c>, value to include in the element.</param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <textarea> element.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <textarea> element.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Combines <see cref="TemplateInfo.HtmlFieldPrefix"/> and <paramref name="expression"/> to set
|
||||
|
|
@ -987,7 +988,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <item>Otherwise, <c>string.Empty</c>.</item>
|
||||
/// </list>
|
||||
/// </remarks>
|
||||
public static HtmlString TextArea(
|
||||
public static IHtmlContent TextArea(
|
||||
[NotNull] this IHtmlHelper htmlHelper,
|
||||
string expression,
|
||||
string value)
|
||||
|
|
@ -1006,7 +1007,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <see cref="System.Collections.Generic.IDictionary{string, object}"/> instance containing the HTML
|
||||
/// attributes.
|
||||
/// </param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <textarea> element.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <textarea> element.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Combines <see cref="TemplateInfo.HtmlFieldPrefix"/> and <paramref name="expression"/> to set
|
||||
|
|
@ -1033,7 +1034,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <item>Otherwise, <c>string.Empty</c>.</item>
|
||||
/// </list>
|
||||
/// </remarks>
|
||||
public static HtmlString TextArea(
|
||||
public static IHtmlContent TextArea(
|
||||
[NotNull] this IHtmlHelper htmlHelper,
|
||||
string expression,
|
||||
string value,
|
||||
|
|
@ -1049,7 +1050,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <param name="expression">An expression to be evaluated against the current model.</param>
|
||||
/// <typeparam name="TModel">The type of the model.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the <paramref name="expression"/> result.</typeparam>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <textarea> element.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <textarea> element.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Combines <see cref="TemplateInfo.HtmlFieldPrefix"/> and the string representation of the
|
||||
|
|
@ -1068,7 +1069,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <item>Otherwise, <c>string.Empty</c>.</item>
|
||||
/// </list>
|
||||
/// </remarks>
|
||||
public static HtmlString TextAreaFor<TModel, TResult>(
|
||||
public static IHtmlContent TextAreaFor<TModel, TResult>(
|
||||
[NotNull] this IHtmlHelper<TModel> htmlHelper,
|
||||
[NotNull] Expression<Func<TModel, TResult>> expression)
|
||||
{
|
||||
|
|
@ -1087,7 +1088,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// </param>
|
||||
/// <typeparam name="TModel">The type of the model.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the <paramref name="expression"/> result.</typeparam>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <textarea> element.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <textarea> element.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Combines <see cref="TemplateInfo.HtmlFieldPrefix"/> and the string representation of the
|
||||
|
|
@ -1106,7 +1107,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <item>Otherwise, <c>string.Empty</c>.</item>
|
||||
/// </list>
|
||||
/// </remarks>
|
||||
public static HtmlString TextAreaFor<TModel, TResult>(
|
||||
public static IHtmlContent TextAreaFor<TModel, TResult>(
|
||||
[NotNull] this IHtmlHelper<TModel> htmlHelper,
|
||||
[NotNull] Expression<Func<TModel, TResult>> expression,
|
||||
object htmlAttributes)
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
using System;
|
||||
using System.Linq.Expressions;
|
||||
using Microsoft.AspNet.Html.Abstractions;
|
||||
using Microsoft.Framework.Internal;
|
||||
|
||||
namespace Microsoft.AspNet.Mvc.Rendering
|
||||
|
|
@ -17,8 +18,8 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// </summary>
|
||||
/// <param name="htmlHelper">The <see cref="IHtmlHelper"/> instance this method extends.</param>
|
||||
/// <param name="expression">Expression name, relative to the current model.</param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <label> element.</returns>
|
||||
public static HtmlString Label([NotNull] this IHtmlHelper htmlHelper, string expression)
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <label> element.</returns>
|
||||
public static IHtmlContent Label([NotNull] this IHtmlHelper htmlHelper, string expression)
|
||||
{
|
||||
return htmlHelper.Label(expression, labelText: null, htmlAttributes: null);
|
||||
}
|
||||
|
|
@ -29,8 +30,8 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <param name="htmlHelper">The <see cref="IHtmlHelper"/> instance this method extends.</param>
|
||||
/// <param name="expression">Expression name, relative to the current model.</param>
|
||||
/// <param name="labelText">The inner text of the element.</param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <label> element.</returns>
|
||||
public static HtmlString Label([NotNull] this IHtmlHelper htmlHelper, string expression, string labelText)
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <label> element.</returns>
|
||||
public static IHtmlContent Label([NotNull] this IHtmlHelper htmlHelper, string expression, string labelText)
|
||||
{
|
||||
return htmlHelper.Label(expression, labelText, htmlAttributes: null);
|
||||
}
|
||||
|
|
@ -42,8 +43,8 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <param name="expression">An expression to be evaluated against the current model.</param>
|
||||
/// <typeparam name="TModel">The type of the model.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the <paramref name="expression"/> result.</typeparam>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <label> element.</returns>
|
||||
public static HtmlString LabelFor<TModel, TResult>(
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <label> element.</returns>
|
||||
public static IHtmlContent LabelFor<TModel, TResult>(
|
||||
[NotNull] this IHtmlHelper<TModel> htmlHelper,
|
||||
[NotNull] Expression<Func<TModel, TResult>> expression)
|
||||
{
|
||||
|
|
@ -58,8 +59,8 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <param name="labelText">The inner text of the element.</param>
|
||||
/// <typeparam name="TModel">The type of the model.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the <paramref name="expression"/> result.</typeparam>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <label> element.</returns>
|
||||
public static HtmlString LabelFor<TModel, TResult>(
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <label> element.</returns>
|
||||
public static IHtmlContent LabelFor<TModel, TResult>(
|
||||
[NotNull] this IHtmlHelper<TModel> htmlHelper,
|
||||
[NotNull] Expression<Func<TModel, TResult>> expression,
|
||||
string labelText)
|
||||
|
|
@ -79,8 +80,8 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// </param>
|
||||
/// <typeparam name="TModel">The type of the model.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the <paramref name="expression"/> result.</typeparam>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <label> element.</returns>
|
||||
public static HtmlString LabelFor<TModel, TResult>(
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <label> element.</returns>
|
||||
public static IHtmlContent LabelFor<TModel, TResult>(
|
||||
[NotNull] this IHtmlHelper<TModel> htmlHelper,
|
||||
[NotNull] Expression<Func<TModel, TResult>> expression,
|
||||
object htmlAttributes)
|
||||
|
|
@ -92,8 +93,8 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// Returns a <label> element for the current model.
|
||||
/// </summary>
|
||||
/// <param name="htmlHelper">The <see cref="IHtmlHelper"/> instance this method extends.</param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <label> element.</returns>
|
||||
public static HtmlString LabelForModel([NotNull] this IHtmlHelper htmlHelper)
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <label> element.</returns>
|
||||
public static IHtmlContent LabelForModel([NotNull] this IHtmlHelper htmlHelper)
|
||||
{
|
||||
return htmlHelper.Label(expression: null, labelText: null, htmlAttributes: null);
|
||||
}
|
||||
|
|
@ -103,8 +104,8 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// </summary>
|
||||
/// <param name="htmlHelper">The <see cref="IHtmlHelper"/> instance this method extends.</param>
|
||||
/// <param name="labelText">The inner text of the element.</param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <label> element.</returns>
|
||||
public static HtmlString LabelForModel([NotNull] this IHtmlHelper htmlHelper, string labelText)
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <label> element.</returns>
|
||||
public static IHtmlContent LabelForModel([NotNull] this IHtmlHelper htmlHelper, string labelText)
|
||||
{
|
||||
return htmlHelper.Label(expression: null, labelText: labelText, htmlAttributes: null);
|
||||
}
|
||||
|
|
@ -118,8 +119,8 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <see cref="System.Collections.Generic.IDictionary{string, object}"/> instance containing the HTML
|
||||
/// attributes.
|
||||
/// </param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <label> element.</returns>
|
||||
public static HtmlString LabelForModel([NotNull] this IHtmlHelper htmlHelper, object htmlAttributes)
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <label> element.</returns>
|
||||
public static IHtmlContent LabelForModel([NotNull] this IHtmlHelper htmlHelper, object htmlAttributes)
|
||||
{
|
||||
return htmlHelper.Label(expression: null, labelText: null, htmlAttributes: htmlAttributes);
|
||||
}
|
||||
|
|
@ -134,8 +135,8 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <see cref="System.Collections.Generic.IDictionary{string, object}"/> instance containing the HTML
|
||||
/// attributes.
|
||||
/// </param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <label> element.</returns>
|
||||
public static HtmlString LabelForModel(
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <label> element.</returns>
|
||||
public static IHtmlContent LabelForModel(
|
||||
[NotNull] this IHtmlHelper htmlHelper,
|
||||
string labelText,
|
||||
object htmlAttributes)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
// 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.AspNet.Html.Abstractions;
|
||||
using Microsoft.Framework.Internal;
|
||||
|
||||
namespace Microsoft.AspNet.Mvc.Rendering
|
||||
|
|
@ -16,8 +17,8 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <param name="helper">The <see cref="IHtmlHelper"/> instance this method extends.</param>
|
||||
/// <param name="linkText">The inner text of the anchor element. Must not be <c>null</c>.</param>
|
||||
/// <param name="actionName">The name of the action.</param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the anchor element.</returns>
|
||||
public static HtmlString ActionLink(
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the anchor element.</returns>
|
||||
public static IHtmlContent ActionLink(
|
||||
[NotNull] this IHtmlHelper helper,
|
||||
[NotNull] string linkText,
|
||||
string actionName)
|
||||
|
|
@ -46,8 +47,8 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <see cref="System.Collections.Generic.IDictionary{string, object}"/> instance containing the route
|
||||
/// parameters.
|
||||
/// </param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the anchor element.</returns>
|
||||
public static HtmlString ActionLink(
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the anchor element.</returns>
|
||||
public static IHtmlContent ActionLink(
|
||||
[NotNull] this IHtmlHelper helper,
|
||||
[NotNull] string linkText,
|
||||
string actionName,
|
||||
|
|
@ -82,8 +83,8 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <see cref="System.Collections.Generic.IDictionary{string, object}"/> instance containing the HTML
|
||||
/// attributes.
|
||||
/// </param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the anchor element.</returns>
|
||||
public static HtmlString ActionLink(
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the anchor element.</returns>
|
||||
public static IHtmlContent ActionLink(
|
||||
[NotNull] this IHtmlHelper helper,
|
||||
[NotNull] string linkText,
|
||||
string actionName,
|
||||
|
|
@ -108,8 +109,8 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <param name="linkText">The inner text of the anchor element. Must not be <c>null</c>.</param>
|
||||
/// <param name="actionName">The name of the action.</param>
|
||||
/// <param name="controllerName">The name of the controller.</param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the anchor element.</returns>
|
||||
public static HtmlString ActionLink(
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the anchor element.</returns>
|
||||
public static IHtmlContent ActionLink(
|
||||
[NotNull] this IHtmlHelper helper,
|
||||
[NotNull] string linkText,
|
||||
string actionName,
|
||||
|
|
@ -140,8 +141,8 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <see cref="System.Collections.Generic.IDictionary{string, object}"/> instance containing the route
|
||||
/// parameters.
|
||||
/// </param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the anchor element.</returns>
|
||||
public static HtmlString ActionLink(
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the anchor element.</returns>
|
||||
public static IHtmlContent ActionLink(
|
||||
[NotNull] this IHtmlHelper helper,
|
||||
[NotNull] string linkText,
|
||||
string actionName,
|
||||
|
|
@ -178,8 +179,8 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <see cref="System.Collections.Generic.IDictionary{string, object}"/> instance containing the HTML
|
||||
/// attributes.
|
||||
/// </param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the anchor element.</returns>
|
||||
public static HtmlString ActionLink(
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the anchor element.</returns>
|
||||
public static IHtmlContent ActionLink(
|
||||
[NotNull] this IHtmlHelper helper,
|
||||
[NotNull] string linkText,
|
||||
string actionName,
|
||||
|
|
@ -210,8 +211,8 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <see cref="System.Collections.Generic.IDictionary{string, object}"/> instance containing the route
|
||||
/// parameters.
|
||||
/// </param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the anchor element.</returns>
|
||||
public static HtmlString RouteLink(
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the anchor element.</returns>
|
||||
public static IHtmlContent RouteLink(
|
||||
[NotNull] this IHtmlHelper htmlHelper,
|
||||
[NotNull] string linkText,
|
||||
object routeValues)
|
||||
|
|
@ -232,8 +233,8 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <param name="htmlHelper">The <see cref="IHtmlHelper"/> instance this method extends.</param>
|
||||
/// <param name="linkText">The inner text of the anchor element. Must not be <c>null</c>.</param>
|
||||
/// <param name="routeName">The name of the route.</param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the anchor element.</returns>
|
||||
public static HtmlString RouteLink(
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the anchor element.</returns>
|
||||
public static IHtmlContent RouteLink(
|
||||
[NotNull] this IHtmlHelper htmlHelper,
|
||||
[NotNull] string linkText,
|
||||
string routeName)
|
||||
|
|
@ -261,8 +262,8 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <see cref="System.Collections.Generic.IDictionary{string, object}"/> instance containing the route
|
||||
/// parameters.
|
||||
/// </param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the anchor element.</returns>
|
||||
public static HtmlString RouteLink(
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the anchor element.</returns>
|
||||
public static IHtmlContent RouteLink(
|
||||
[NotNull] this IHtmlHelper htmlHelper,
|
||||
[NotNull] string linkText,
|
||||
string routeName,
|
||||
|
|
@ -295,8 +296,8 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <see cref="System.Collections.Generic.IDictionary{string, object}"/> instance containing the HTML
|
||||
/// attributes.
|
||||
/// </param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the anchor element.</returns>
|
||||
public static HtmlString RouteLink(
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the anchor element.</returns>
|
||||
public static IHtmlContent RouteLink(
|
||||
[NotNull] this IHtmlHelper htmlHelper,
|
||||
[NotNull] string linkText,
|
||||
object routeValues,
|
||||
|
|
@ -330,8 +331,8 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <see cref="System.Collections.Generic.IDictionary{string, object}"/> instance containing the HTML
|
||||
/// attributes.
|
||||
/// </param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the anchor element.</returns>
|
||||
public static HtmlString RouteLink(
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the anchor element.</returns>
|
||||
public static IHtmlContent RouteLink(
|
||||
[NotNull] this IHtmlHelper htmlHelper,
|
||||
[NotNull] string linkText,
|
||||
string routeName,
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq.Expressions;
|
||||
using Microsoft.AspNet.Html.Abstractions;
|
||||
using Microsoft.Framework.Internal;
|
||||
|
||||
namespace Microsoft.AspNet.Mvc.Rendering
|
||||
|
|
@ -18,13 +19,13 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// </summary>
|
||||
/// <param name="htmlHelper">The <see cref="IHtmlHelper"/> instance this method extends.</param>
|
||||
/// <param name="expression">Expression name, relative to the current model.</param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <select> element.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <select> element.</returns>
|
||||
/// <remarks>
|
||||
/// Combines <see cref="TemplateInfo.HtmlFieldPrefix"/> and <paramref name="expression"/> to set
|
||||
/// <select> element's "name" attribute. Sanitizes <paramref name="expression"/> to set element's "id"
|
||||
/// attribute.
|
||||
/// </remarks>
|
||||
public static HtmlString DropDownList([NotNull] this IHtmlHelper htmlHelper, string expression)
|
||||
public static IHtmlContent DropDownList([NotNull] this IHtmlHelper htmlHelper, string expression)
|
||||
{
|
||||
return htmlHelper.DropDownList(expression, selectList: null, optionLabel: null, htmlAttributes: null);
|
||||
}
|
||||
|
|
@ -38,13 +39,13 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <param name="optionLabel">
|
||||
/// The text for a default empty item. Does not include such an item if argument is <c>null</c>.
|
||||
/// </param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <select> element.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <select> element.</returns>
|
||||
/// <remarks>
|
||||
/// Combines <see cref="TemplateInfo.HtmlFieldPrefix"/> and <paramref name="expression"/> to set
|
||||
/// <select> element's "name" attribute. Sanitizes <paramref name="expression"/> to set element's "id"
|
||||
/// attribute.
|
||||
/// </remarks>
|
||||
public static HtmlString DropDownList(
|
||||
public static IHtmlContent DropDownList(
|
||||
[NotNull] this IHtmlHelper htmlHelper,
|
||||
string expression,
|
||||
string optionLabel)
|
||||
|
|
@ -66,13 +67,13 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// A collection of <see cref="SelectListItem"/> objects used to populate the <select> element with
|
||||
/// <optgroup> and <option> elements.
|
||||
/// </param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <select> element.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <select> element.</returns>
|
||||
/// <remarks>
|
||||
/// Combines <see cref="TemplateInfo.HtmlFieldPrefix"/> and <paramref name="expression"/> to set
|
||||
/// <select> element's "name" attribute. Sanitizes <paramref name="expression"/> to set element's "id"
|
||||
/// attribute.
|
||||
/// </remarks>
|
||||
public static HtmlString DropDownList(
|
||||
public static IHtmlContent DropDownList(
|
||||
[NotNull] this IHtmlHelper htmlHelper,
|
||||
string expression,
|
||||
IEnumerable<SelectListItem> selectList)
|
||||
|
|
@ -94,13 +95,13 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// An <see cref="object"/> that contains the HTML attributes for the <select> element. Alternatively, an
|
||||
/// <see cref="IDictionary{string, object}"/> instance containing the HTML attributes.
|
||||
/// </param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <select> element.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <select> element.</returns>
|
||||
/// <remarks>
|
||||
/// Combines <see cref="TemplateInfo.HtmlFieldPrefix"/> and <paramref name="expression"/> to set
|
||||
/// <select> element's "name" attribute. Sanitizes <paramref name="expression"/> to set element's "id"
|
||||
/// attribute.
|
||||
/// </remarks>
|
||||
public static HtmlString DropDownList(
|
||||
public static IHtmlContent DropDownList(
|
||||
[NotNull] this IHtmlHelper htmlHelper,
|
||||
string expression,
|
||||
IEnumerable<SelectListItem> selectList,
|
||||
|
|
@ -122,13 +123,13 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <param name="optionLabel">
|
||||
/// The text for a default empty item. Does not include such an item if argument is <c>null</c>.
|
||||
/// </param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <select> element.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <select> element.</returns>
|
||||
/// <remarks>
|
||||
/// Combines <see cref="TemplateInfo.HtmlFieldPrefix"/> and <paramref name="expression"/> to set
|
||||
/// <select> element's "name" attribute. Sanitizes <paramref name="expression"/> to set element's "id"
|
||||
/// attribute.
|
||||
/// </remarks>
|
||||
public static HtmlString DropDownList(
|
||||
public static IHtmlContent DropDownList(
|
||||
[NotNull] this IHtmlHelper htmlHelper,
|
||||
string expression,
|
||||
IEnumerable<SelectListItem> selectList,
|
||||
|
|
@ -149,13 +150,13 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// </param>
|
||||
/// <typeparam name="TModel">The type of the model.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the <paramref name="expression"/> result.</typeparam>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <select> element.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <select> element.</returns>
|
||||
/// <remarks>
|
||||
/// Combines <see cref="TemplateInfo.HtmlFieldPrefix"/> and the string representation of the
|
||||
/// <paramref name="expression"/> to set <select> element's "name" attribute. Sanitizes the string
|
||||
/// representation of the <paramref name="expression"/> to set element's "id" attribute.
|
||||
/// </remarks>
|
||||
public static HtmlString DropDownListFor<TModel, TResult>(
|
||||
public static IHtmlContent DropDownListFor<TModel, TResult>(
|
||||
[NotNull] this IHtmlHelper<TModel> htmlHelper,
|
||||
[NotNull] Expression<Func<TModel, TResult>> expression,
|
||||
IEnumerable<SelectListItem> selectList)
|
||||
|
|
@ -179,13 +180,13 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// </param>
|
||||
/// <typeparam name="TModel">The type of the model.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the <paramref name="expression"/> result.</typeparam>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <select> element.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <select> element.</returns>
|
||||
/// <remarks>
|
||||
/// Combines <see cref="TemplateInfo.HtmlFieldPrefix"/> and the string representation of the
|
||||
/// <paramref name="expression"/> to set <select> element's "name" attribute. Sanitizes the string
|
||||
/// representation of the <paramref name="expression"/> to set element's "id" attribute.
|
||||
/// </remarks>
|
||||
public static HtmlString DropDownListFor<TModel, TResult>(
|
||||
public static IHtmlContent DropDownListFor<TModel, TResult>(
|
||||
[NotNull] this IHtmlHelper<TModel> htmlHelper,
|
||||
[NotNull] Expression<Func<TModel, TResult>> expression,
|
||||
IEnumerable<SelectListItem> selectList,
|
||||
|
|
@ -213,13 +214,13 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// </param>
|
||||
/// <typeparam name="TModel">The type of the model.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the <paramref name="expression"/> result.</typeparam>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <select> element.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <select> element.</returns>
|
||||
/// <remarks>
|
||||
/// Combines <see cref="TemplateInfo.HtmlFieldPrefix"/> and the string representation of the
|
||||
/// <paramref name="expression"/> to set <select> element's "name" attribute. Sanitizes the string
|
||||
/// representation of the <paramref name="expression"/> to set element's "id" attribute.
|
||||
/// </remarks>
|
||||
public static HtmlString DropDownListFor<TModel, TResult>(
|
||||
public static IHtmlContent DropDownListFor<TModel, TResult>(
|
||||
[NotNull] this IHtmlHelper<TModel> htmlHelper,
|
||||
[NotNull] Expression<Func<TModel, TResult>> expression,
|
||||
IEnumerable<SelectListItem> selectList,
|
||||
|
|
@ -233,13 +234,13 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// </summary>
|
||||
/// <param name="htmlHelper">The <see cref="IHtmlHelper"/> instance this method extends.</param>
|
||||
/// <param name="expression">Expression name, relative to the current model.</param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <select> element.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <select> element.</returns>
|
||||
/// <remarks>
|
||||
/// Combines <see cref="TemplateInfo.HtmlFieldPrefix"/> and <paramref name="expression"/> to set
|
||||
/// <select> element's "name" attribute. Sanitizes <paramref name="expression"/> to set element's "id"
|
||||
/// attribute.
|
||||
/// </remarks>
|
||||
public static HtmlString ListBox([NotNull] this IHtmlHelper htmlHelper, string expression)
|
||||
public static IHtmlContent ListBox([NotNull] this IHtmlHelper htmlHelper, string expression)
|
||||
{
|
||||
return htmlHelper.ListBox(expression, selectList: null, htmlAttributes: null);
|
||||
}
|
||||
|
|
@ -254,13 +255,13 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// A collection of <see cref="SelectListItem"/> objects used to populate the <select> element with
|
||||
/// <optgroup> and <option> elements.
|
||||
/// </param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <select> element.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <select> element.</returns>
|
||||
/// <remarks>
|
||||
/// Combines <see cref="TemplateInfo.HtmlFieldPrefix"/> and <paramref name="expression"/> to set
|
||||
/// <select> element's "name" attribute. Sanitizes <paramref name="expression"/> to set element's "id"
|
||||
/// attribute.
|
||||
/// </remarks>
|
||||
public static HtmlString ListBox(
|
||||
public static IHtmlContent ListBox(
|
||||
[NotNull] this IHtmlHelper htmlHelper,
|
||||
string expression,
|
||||
IEnumerable<SelectListItem> selectList)
|
||||
|
|
@ -280,13 +281,13 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// </param>
|
||||
/// <typeparam name="TModel">The type of the model.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the <paramref name="expression"/> result.</typeparam>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <select> element.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <select> element.</returns>
|
||||
/// <remarks>
|
||||
/// Combines <see cref="TemplateInfo.HtmlFieldPrefix"/> and the string representation of the
|
||||
/// <paramref name="expression"/> to set <select> element's "name" attribute. Sanitizes the string
|
||||
/// representation of the <paramref name="expression"/> to set element's "id" attribute.
|
||||
/// </remarks>
|
||||
public static HtmlString ListBoxFor<TModel, TResult>(
|
||||
public static IHtmlContent ListBoxFor<TModel, TResult>(
|
||||
[NotNull] this IHtmlHelper<TModel> htmlHelper,
|
||||
[NotNull] Expression<Func<TModel, TResult>> expression,
|
||||
IEnumerable<SelectListItem> selectList)
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
using System;
|
||||
using System.Linq.Expressions;
|
||||
using Microsoft.AspNet.Html.Abstractions;
|
||||
using Microsoft.Framework.Internal;
|
||||
|
||||
namespace Microsoft.AspNet.Mvc.Rendering
|
||||
|
|
@ -19,14 +20,14 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <param name="htmlHelper">The <see cref="IHtmlHelper"/> instance this method extends.</param>
|
||||
/// <param name="expression">Expression name, relative to the current model.</param>
|
||||
/// <returns>
|
||||
/// A new <see cref="HtmlString"/> containing a <see cref="ViewContext.ValidationMessageElement"/> element.
|
||||
/// A new <see cref="IHtmlContent"/> containing a <see cref="ViewContext.ValidationMessageElement"/> element.
|
||||
/// <c>null</c> if the <paramref name="expression"/> is valid and client-side validation is disabled.
|
||||
/// </returns>
|
||||
/// <remarks>
|
||||
/// Method extracts an error string from the <see cref="ModelBinding.ModelStateDictionary"/> object. Message
|
||||
/// will always be visible but client-side validation may update the associated CSS class.
|
||||
/// </remarks>
|
||||
public static HtmlString ValidationMessage(
|
||||
public static IHtmlContent ValidationMessage(
|
||||
[NotNull] this IHtmlHelper htmlHelper,
|
||||
string expression)
|
||||
{
|
||||
|
|
@ -45,10 +46,10 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// validation may update the associated CSS class.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A new <see cref="HtmlString"/> containing a <see cref="ViewContext.ValidationMessageElement"/> element.
|
||||
/// A new <see cref="IHtmlContent"/> containing a <see cref="ViewContext.ValidationMessageElement"/> element.
|
||||
/// <c>null</c> if the <paramref name="expression"/> is valid and client-side validation is disabled.
|
||||
/// </returns>
|
||||
public static HtmlString ValidationMessage(
|
||||
public static IHtmlContent ValidationMessage(
|
||||
[NotNull] this IHtmlHelper htmlHelper,
|
||||
string expression,
|
||||
string message)
|
||||
|
|
@ -69,14 +70,14 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// attributes.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A new <see cref="HtmlString"/> containing a <see cref="ViewContext.ValidationMessageElement"/> element.
|
||||
/// A new <see cref="IHtmlContent"/> containing a <see cref="ViewContext.ValidationMessageElement"/> element.
|
||||
/// <c>null</c> if the <paramref name="expression"/> is valid and client-side validation is disabled.
|
||||
/// </returns>
|
||||
/// <remarks>
|
||||
/// Method extracts an error string from the <see cref="ModelBinding.ModelStateDictionary"/> object. Message
|
||||
/// will always be visible but client-side validation may update the associated CSS class.
|
||||
/// </remarks>
|
||||
public static HtmlString ValidationMessage(
|
||||
public static IHtmlContent ValidationMessage(
|
||||
[NotNull] this IHtmlHelper htmlHelper,
|
||||
string expression,
|
||||
object htmlAttributes)
|
||||
|
|
@ -100,10 +101,10 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <see cref="ViewContext.ValidationMessageElement"/>.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A new <see cref="HtmlString"/> containing a <paramref name="tag"/> element. <c>null</c> if the
|
||||
/// A new <see cref="IHtmlContent"/> containing a <paramref name="tag"/> element. <c>null</c> if the
|
||||
/// <paramref name="expression"/> is valid and client-side validation is disabled.
|
||||
/// </returns>
|
||||
public static HtmlString ValidationMessage(
|
||||
public static IHtmlContent ValidationMessage(
|
||||
[NotNull] this IHtmlHelper htmlHelper,
|
||||
string expression,
|
||||
string message,
|
||||
|
|
@ -130,10 +131,10 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// attributes.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A new <see cref="HtmlString"/> containing a <see cref="ViewContext.ValidationMessageElement"/> element.
|
||||
/// A new <see cref="IHtmlContent"/> containing a <see cref="ViewContext.ValidationMessageElement"/> element.
|
||||
/// <c>null</c> if the <paramref name="expression"/> is valid and client-side validation is disabled.
|
||||
/// </returns>
|
||||
public static HtmlString ValidationMessage(
|
||||
public static IHtmlContent ValidationMessage(
|
||||
[NotNull] this IHtmlHelper htmlHelper,
|
||||
string expression,
|
||||
string message,
|
||||
|
|
@ -151,14 +152,14 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <typeparam name="TModel">The type of the model.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the <paramref name="expression"/> result.</typeparam>
|
||||
/// <returns>
|
||||
/// A new <see cref="HtmlString"/> containing a <see cref="ViewContext.ValidationMessageElement"/> element.
|
||||
/// A new <see cref="IHtmlContent"/> containing a <see cref="ViewContext.ValidationMessageElement"/> element.
|
||||
/// <c>null</c> if the <paramref name="expression"/> is valid and client-side validation is disabled.
|
||||
/// </returns>
|
||||
/// <remarks>
|
||||
/// Method extracts an error string from the <see cref="ModelBinding.ModelStateDictionary"/> object. Message
|
||||
/// will always be visible but client-side validation may update the associated CSS class.
|
||||
/// </remarks>
|
||||
public static HtmlString ValidationMessageFor<TModel, TResult>(
|
||||
public static IHtmlContent ValidationMessageFor<TModel, TResult>(
|
||||
[NotNull] this IHtmlHelper<TModel> htmlHelper,
|
||||
[NotNull] Expression<Func<TModel, TResult>> expression)
|
||||
{
|
||||
|
|
@ -179,10 +180,10 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <typeparam name="TModel">The type of the model.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the <paramref name="expression"/> result.</typeparam>
|
||||
/// <returns>
|
||||
/// A new <see cref="HtmlString"/> containing a <see cref="ViewContext.ValidationMessageElement"/> element.
|
||||
/// A new <see cref="IHtmlContent"/> containing a <see cref="ViewContext.ValidationMessageElement"/> element.
|
||||
/// <c>null</c> if the <paramref name="expression"/> is valid and client-side validation is disabled.
|
||||
/// </returns>
|
||||
public static HtmlString ValidationMessageFor<TModel, TResult>(
|
||||
public static IHtmlContent ValidationMessageFor<TModel, TResult>(
|
||||
[NotNull] this IHtmlHelper<TModel> htmlHelper,
|
||||
[NotNull] Expression<Func<TModel, TResult>> expression,
|
||||
string message)
|
||||
|
|
@ -210,10 +211,10 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <typeparam name="TModel">The type of the model.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the <paramref name="expression"/> result.</typeparam>
|
||||
/// <returns>
|
||||
/// A new <see cref="HtmlString"/> containing a <see cref="ViewContext.ValidationMessageElement"/> element.
|
||||
/// A new <see cref="IHtmlContent"/> containing a <see cref="ViewContext.ValidationMessageElement"/> element.
|
||||
/// <c>null</c> if the <paramref name="expression"/> is valid and client-side validation is disabled.
|
||||
/// </returns>
|
||||
public static HtmlString ValidationMessageFor<TModel, TResult>(
|
||||
public static IHtmlContent ValidationMessageFor<TModel, TResult>(
|
||||
[NotNull] this IHtmlHelper<TModel> htmlHelper,
|
||||
[NotNull] Expression<Func<TModel, TResult>> expression,
|
||||
string message,
|
||||
|
|
@ -240,10 +241,10 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <typeparam name="TModel">The type of the model.</typeparam>
|
||||
/// <typeparam name="TResult">The type of the <paramref name="expression"/> result.</typeparam>
|
||||
/// <returns>
|
||||
/// A new <see cref="HtmlString"/> containing the <paramref name="tag"/> element. <c>null</c> if the
|
||||
/// A new <see cref="IHtmlContent"/> containing the <paramref name="tag"/> element. <c>null</c> if the
|
||||
/// <paramref name="expression"/> is valid and client-side validation is disabled.
|
||||
/// </returns>
|
||||
public static HtmlString ValidationMessageFor<TModel, TResult>(
|
||||
public static IHtmlContent ValidationMessageFor<TModel, TResult>(
|
||||
[NotNull] this IHtmlHelper<TModel> htmlHelper,
|
||||
[NotNull] Expression<Func<TModel, TResult>> expression,
|
||||
string message,
|
||||
|
|
@ -258,10 +259,10 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// </summary>
|
||||
/// <param name="htmlHelper">The <see cref="IHtmlHelper"/> instance this method extends.</param>
|
||||
/// <returns>
|
||||
/// New <see cref="HtmlString"/> containing a <div> element wrapping the <ul> element.
|
||||
/// New <see cref="IHtmlContent"/> containing a <div> element wrapping the <ul> element.
|
||||
/// <see cref="HtmlString.Empty"/> if the current model is valid and client-side validation is disabled).
|
||||
/// </returns>
|
||||
public static HtmlString ValidationSummary([NotNull] this IHtmlHelper htmlHelper)
|
||||
public static IHtmlContent ValidationSummary([NotNull] this IHtmlHelper htmlHelper)
|
||||
{
|
||||
return htmlHelper.ValidationSummary(
|
||||
excludePropertyErrors: false,
|
||||
|
|
@ -279,10 +280,10 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// If <c>true</c>, display model-level errors only; otherwise display all errors.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// New <see cref="HtmlString"/> containing a <div> element wrapping the <ul> element.
|
||||
/// New <see cref="IHtmlContent"/> containing a <div> element wrapping the <ul> element.
|
||||
/// <see cref="HtmlString.Empty"/> if the current model is valid and client-side validation is disabled).
|
||||
/// </returns>
|
||||
public static HtmlString ValidationSummary([NotNull] this IHtmlHelper htmlHelper, bool excludePropertyErrors)
|
||||
public static IHtmlContent ValidationSummary([NotNull] this IHtmlHelper htmlHelper, bool excludePropertyErrors)
|
||||
{
|
||||
return htmlHelper.ValidationSummary(
|
||||
excludePropertyErrors,
|
||||
|
|
@ -298,12 +299,12 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <param name="htmlHelper">The <see cref="IHtmlHelper"/> instance this method extends.</param>
|
||||
/// <param name="message">The message to display with the validation summary.</param>
|
||||
/// <returns>
|
||||
/// New <see cref="HtmlString"/> containing a <div> element wrapping the
|
||||
/// New <see cref="IHtmlContent"/> containing a <div> element wrapping the
|
||||
/// <see cref="ViewContext.ValidationSummaryMessageElement" /> element (which wraps the
|
||||
/// <paramref name="message"/>) and the <ul> element. <see cref="HtmlString.Empty"/> if the current model
|
||||
/// is valid and client-side validation is disabled).
|
||||
/// </returns>
|
||||
public static HtmlString ValidationSummary([NotNull] this IHtmlHelper htmlHelper, string message)
|
||||
public static IHtmlContent ValidationSummary([NotNull] this IHtmlHelper htmlHelper, string message)
|
||||
{
|
||||
return htmlHelper.ValidationSummary(
|
||||
excludePropertyErrors: false,
|
||||
|
|
@ -323,11 +324,11 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <see cref="ViewContext.ValidationSummaryMessageElement" />.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// New <see cref="HtmlString"/> containing a <div> element wrapping the <paramref name="tag"/> element
|
||||
/// New <see cref="IHtmlContent"/> containing a <div> element wrapping the <paramref name="tag"/> element
|
||||
/// and the <ul> element. <see cref="HtmlString.Empty"/> if the current model is valid and client-side
|
||||
/// validation is disabled).
|
||||
/// </returns>
|
||||
public static HtmlString ValidationSummary([NotNull] this IHtmlHelper htmlHelper, string message, string tag)
|
||||
public static IHtmlContent ValidationSummary([NotNull] this IHtmlHelper htmlHelper, string message, string tag)
|
||||
{
|
||||
return htmlHelper.ValidationSummary(
|
||||
excludePropertyErrors: false,
|
||||
|
|
@ -346,12 +347,12 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// </param>
|
||||
/// <param name="message">The message to display with the validation summary.</param>
|
||||
/// <returns>
|
||||
/// New <see cref="HtmlString"/> containing a <div> element wrapping the
|
||||
/// New <see cref="IHtmlContent"/> containing a <div> element wrapping the
|
||||
/// <see cref="ViewContext.ValidationSummaryMessageElement" /> element (which, in turn, wraps the
|
||||
/// <paramref name="message"/>) and the <ul> element. <see cref="HtmlString.Empty"/> if the current model
|
||||
/// is valid and client-side validation is disabled).
|
||||
/// </returns>
|
||||
public static HtmlString ValidationSummary(
|
||||
public static IHtmlContent ValidationSummary(
|
||||
[NotNull] this IHtmlHelper htmlHelper,
|
||||
bool excludePropertyErrors,
|
||||
string message)
|
||||
|
|
@ -375,12 +376,12 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// the HTML attributes.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// New <see cref="HtmlString"/> containing a <div> element wrapping the
|
||||
/// New <see cref="IHtmlContent"/> containing a <div> element wrapping the
|
||||
/// <see cref="ViewContext.ValidationSummaryMessageElement" /> element (which wraps the
|
||||
/// <paramref name="message"/>) and the <ul> element. <see cref="HtmlString.Empty"/> if the current model
|
||||
/// is valid and client-side validation is disabled).
|
||||
/// </returns>
|
||||
public static HtmlString ValidationSummary(
|
||||
public static IHtmlContent ValidationSummary(
|
||||
[NotNull] this IHtmlHelper htmlHelper,
|
||||
string message,
|
||||
object htmlAttributes)
|
||||
|
|
@ -408,11 +409,11 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <see cref="ViewContext.ValidationSummaryMessageElement" />.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// New <see cref="HtmlString"/> containing a <div> element wrapping the <paramref name="tag"/> element
|
||||
/// New <see cref="IHtmlContent"/> containing a <div> element wrapping the <paramref name="tag"/> element
|
||||
/// and the <ul> element. <see cref="HtmlString.Empty"/> if the current model is valid and client-side
|
||||
/// validation is disabled).
|
||||
/// </returns>
|
||||
public static HtmlString ValidationSummary(
|
||||
public static IHtmlContent ValidationSummary(
|
||||
[NotNull] this IHtmlHelper htmlHelper,
|
||||
string message,
|
||||
object htmlAttributes,
|
||||
|
|
@ -439,11 +440,11 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <see cref="ViewContext.ValidationSummaryMessageElement" />.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// New <see cref="HtmlString"/> containing a <div> element wrapping the <paramref name="tag"/> element
|
||||
/// New <see cref="IHtmlContent"/> containing a <div> element wrapping the <paramref name="tag"/> element
|
||||
/// and the <ul> element. <see cref="HtmlString.Empty"/> if the current model is valid and client-side
|
||||
/// validation is disabled).
|
||||
/// </returns>
|
||||
public static HtmlString ValidationSummary(
|
||||
public static IHtmlContent ValidationSummary(
|
||||
[NotNull] this IHtmlHelper htmlHelper,
|
||||
bool excludePropertyErrors,
|
||||
string message,
|
||||
|
|
@ -471,12 +472,12 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// the HTML attributes.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// New <see cref="HtmlString"/> containing a <div> element wrapping the
|
||||
/// New <see cref="IHtmlContent"/> containing a <div> element wrapping the
|
||||
/// <see cref="ViewContext.ValidationSummaryMessageElement" /> element (which wraps the
|
||||
/// <paramref name="message"/>) and the <ul> element. <see cref="HtmlString.Empty"/> if the current model
|
||||
/// is valid and client-side validation is disabled).
|
||||
/// </returns>
|
||||
public static HtmlString ValidationSummary(
|
||||
public static IHtmlContent ValidationSummary(
|
||||
[NotNull] this IHtmlHelper htmlHelper,
|
||||
bool excludePropertyErrors,
|
||||
string message,
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
using System.IO;
|
||||
using Microsoft.AspNet.Html.Abstractions;
|
||||
using Microsoft.Framework.Internal;
|
||||
using Microsoft.Framework.WebEncoders;
|
||||
|
||||
namespace Microsoft.AspNet.Mvc.Rendering
|
||||
|
|
@ -12,36 +13,24 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// </summary>
|
||||
public class HtmlString : IHtmlContent
|
||||
{
|
||||
private static readonly HtmlString _empty = new HtmlString(string.Empty);
|
||||
private readonly string _input;
|
||||
|
||||
/// <summary>
|
||||
/// Instantiates a new instance of <see cref="HtmlString"/>.
|
||||
/// Returns an <see cref="HtmlString"/> with empty content.
|
||||
/// </summary>
|
||||
/// <param name="input"><c>string</c>to initialize <see cref="HtmlString"/>.</param>
|
||||
public static readonly HtmlString Empty = new HtmlString(string.Empty);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance of <see cref="HtmlString"/>.
|
||||
/// </summary>
|
||||
/// <param name="input"><c>string</c> to initialize <see cref="HtmlString"/>.</param>
|
||||
public HtmlString(string input)
|
||||
{
|
||||
_input = input;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns an <see cref="HtmlString"/> with empty content.
|
||||
/// </summary>
|
||||
public static HtmlString Empty
|
||||
{
|
||||
get
|
||||
{
|
||||
return _empty;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Writes the value in this instance of <see cref="HtmlString"/> to the target
|
||||
/// <paramref name="writer"/>.
|
||||
/// </summary>
|
||||
/// <param name="writer">The <see cref="TextWriter"/> to write contents to.</param>
|
||||
/// <param name="encoder">The <see cref="IHtmlEncoder"/> with which the output must be encoded.</param>
|
||||
public void WriteTo(TextWriter writer, IHtmlEncoder encoder)
|
||||
/// <inheritdoc />
|
||||
public void WriteTo([NotNull] TextWriter writer, [NotNull] IHtmlEncoder encoder)
|
||||
{
|
||||
writer.Write(_input);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,11 +54,6 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// </summary>
|
||||
ITempDataDictionary TempData { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="IHtmlEncoder"/> to be used for encoding HTML.
|
||||
/// </summary>
|
||||
IHtmlEncoder HtmlEncoder { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="IUrlEncoder"/> to be used for encoding a URL.
|
||||
/// </summary>
|
||||
|
|
@ -88,8 +83,8 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// An <see cref="object"/> that contains the HTML attributes for the element. Alternatively, an
|
||||
/// <see cref="IDictionary{string, object}"/> instance containing the HTML attributes.
|
||||
/// </param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the anchor element.</returns>
|
||||
HtmlString ActionLink(
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the anchor element.</returns>
|
||||
IHtmlContent ActionLink(
|
||||
[NotNull] string linkText,
|
||||
string actionName,
|
||||
string controllerName,
|
||||
|
|
@ -103,8 +98,8 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// Returns a <hidden> element (antiforgery token) that will be validated when the containing
|
||||
/// <form> is submitted.
|
||||
/// </summary>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <hidden> element.</returns>
|
||||
HtmlString AntiForgeryToken();
|
||||
/// <returns><see cref="IHtmlContent"/> containing the <hidden> element.</returns>
|
||||
IHtmlContent AntiForgeryToken();
|
||||
|
||||
/// <summary>
|
||||
/// Renders a <form> start tag to the response. When the user submits the form, the action with name
|
||||
|
|
@ -174,7 +169,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// An <see cref="object"/> that contains the HTML attributes for the checkbox element. Alternatively, an
|
||||
/// <see cref="IDictionary{string, object}"/> instance containing the HTML attributes.
|
||||
/// </param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <input> elements.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <input> elements.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Combines <see cref="TemplateInfo.HtmlFieldPrefix"/> and <paramref name="expression"/> to set checkbox
|
||||
|
|
@ -206,7 +201,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// value "checked" if the <see cref="bool"/> values is <c>true</c>; does not include the attribute otherwise.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
HtmlString CheckBox(string expression, bool? isChecked, object htmlAttributes);
|
||||
IHtmlContent CheckBox(string expression, bool? isChecked, object htmlAttributes);
|
||||
|
||||
/// <summary>
|
||||
/// Returns HTML markup for the <paramref name="expression"/>, using a display template, specified HTML field
|
||||
|
|
@ -227,7 +222,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// view data that will be merged into the <see cref="ViewDataDictionary{TModel}"/> instance created for the
|
||||
/// template.
|
||||
/// </param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the created HTML.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the created HTML.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// For example the default <see cref="object"/> display template includes markup for each property in the
|
||||
|
|
@ -238,7 +233,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <c>"prop"</c> which identifies the current model's "prop" property.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
HtmlString Display(
|
||||
IHtmlContent Display(
|
||||
string expression,
|
||||
string templateName,
|
||||
string htmlFieldName,
|
||||
|
|
@ -277,13 +272,13 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// An <see cref="object"/> that contains the HTML attributes for the <select> element. Alternatively, an
|
||||
/// <see cref="IDictionary{string, object}"/> instance containing the HTML attributes.
|
||||
/// </param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <select> element.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <select> element.</returns>
|
||||
/// <remarks>
|
||||
/// Combines <see cref="TemplateInfo.HtmlFieldPrefix"/> and <paramref name="expression"/> to set
|
||||
/// <select> element's "name" attribute. Sanitizes <paramref name="expression"/> to set element's "id"
|
||||
/// attribute.
|
||||
/// </remarks>
|
||||
HtmlString DropDownList(
|
||||
IHtmlContent DropDownList(
|
||||
string expression,
|
||||
IEnumerable<SelectListItem> selectList,
|
||||
string optionLabel,
|
||||
|
|
@ -308,7 +303,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// view data that will be merged into the <see cref="ViewDataDictionary{TModel}"/> instance created for the
|
||||
/// template.
|
||||
/// </param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <input> element(s).</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <input> element(s).</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// For example the default <see cref="object"/> editor template includes <label> and <input>
|
||||
|
|
@ -319,7 +314,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <c>"prop"</c> which identifies the current model's "prop" property.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
HtmlString Editor(string expression, string templateName, string htmlFieldName, object additionalViewData);
|
||||
IHtmlContent Editor(string expression, string templateName, string htmlFieldName, object additionalViewData);
|
||||
|
||||
/// <summary>
|
||||
/// Converts the <paramref name="value"/> to an HTML-encoded <see cref="string"/>.
|
||||
|
|
@ -417,7 +412,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// An <see cref="object"/> that contains the HTML attributes for the element. Alternatively, an
|
||||
/// <see cref="IDictionary{string, object}"/> instance containing the HTML attributes.
|
||||
/// </param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <input> element.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <input> element.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Combines <see cref="TemplateInfo.HtmlFieldPrefix"/> and <paramref name="expression"/> to set
|
||||
|
|
@ -445,7 +440,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <item>Otherwise, <c>string.Empty</c>.</item>
|
||||
/// </list>
|
||||
/// </remarks>
|
||||
HtmlString Hidden(string expression, object value, object htmlAttributes);
|
||||
IHtmlContent Hidden(string expression, object value, object htmlAttributes);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the HTML element Id for the specified <paramref name="expression"/>.
|
||||
|
|
@ -463,8 +458,8 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// An <see cref="object"/> that contains the HTML attributes for the element. Alternatively, an
|
||||
/// <see cref="IDictionary{string, object}"/> instance containing the HTML attributes.
|
||||
/// </param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <label> element.</returns>
|
||||
HtmlString Label(string expression, string labelText, object htmlAttributes);
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <label> element.</returns>
|
||||
IHtmlContent Label(string expression, string labelText, object htmlAttributes);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a multi-selection <select> element for the <paramref name="expression"/>, using the
|
||||
|
|
@ -479,13 +474,13 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// An <see cref="object"/> that contains the HTML attributes for the <select> element. Alternatively, an
|
||||
/// <see cref="IDictionary{string, object}"/> instance containing the HTML attributes.
|
||||
/// </param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <select> element.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <select> element.</returns>
|
||||
/// <remarks>
|
||||
/// Combines <see cref="TemplateInfo.HtmlFieldPrefix"/> and <paramref name="expression"/> to set
|
||||
/// <select> element's "name" attribute. Sanitizes <paramref name="expression"/> to set element's "id"
|
||||
/// attribute.
|
||||
/// </remarks>
|
||||
HtmlString ListBox(string expression, IEnumerable<SelectListItem> selectList, object htmlAttributes);
|
||||
IHtmlContent ListBox(string expression, IEnumerable<SelectListItem> selectList, object htmlAttributes);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the full HTML element name for the specified <paramref name="expression"/>.
|
||||
|
|
@ -517,7 +512,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// An <see cref="object"/> that contains the HTML attributes for the element. Alternatively, an
|
||||
/// <see cref="IDictionary{string, object}"/> instance containing the HTML attributes.
|
||||
/// </param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <input> element.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <input> element.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Combines <see cref="TemplateInfo.HtmlFieldPrefix"/> and <paramref name="expression"/> to set
|
||||
|
|
@ -531,7 +526,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <item>Otherwise, <c>string.Empty</c>.</item>
|
||||
/// </list>
|
||||
/// </remarks>
|
||||
HtmlString Password(string expression, object value, object htmlAttributes);
|
||||
IHtmlContent Password(string expression, object value, object htmlAttributes);
|
||||
|
||||
/// <summary>
|
||||
/// Returns an <input> element of type "radio" for the specified <paramref name="expression"/>.
|
||||
|
|
@ -551,7 +546,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// An <see cref="object"/> that contains the HTML attributes for the element. Alternatively, an
|
||||
/// <see cref="IDictionary{string, object}"/> instance containing the HTML attributes.
|
||||
/// </param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <input> element.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <input> element.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Combines <see cref="TemplateInfo.HtmlFieldPrefix"/> and <paramref name="expression"/> to set
|
||||
|
|
@ -591,23 +586,23 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// the attribute otherwise.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
HtmlString RadioButton(string expression, object value, bool? isChecked, object htmlAttributes);
|
||||
IHtmlContent RadioButton(string expression, object value, bool? isChecked, object htmlAttributes);
|
||||
|
||||
/// <summary>
|
||||
/// Wraps HTML markup in an <see cref="HtmlString"/>, without HTML-encoding the specified
|
||||
/// <paramref name="value"/>.
|
||||
/// </summary>
|
||||
/// <param name="value">HTML markup <see cref="string"/>.</param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the wrapped <see cref="string"/>.</returns>
|
||||
HtmlString Raw(string value);
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the wrapped <see cref="string"/>.</returns>
|
||||
IHtmlContent Raw(string value);
|
||||
|
||||
/// <summary>
|
||||
/// Wraps HTML markup from the string representation of an <see cref="object"/> in an
|
||||
/// <see cref="HtmlString"/>, without HTML-encoding the string representation.
|
||||
/// </summary>
|
||||
/// <param name="value">The <see cref="object"/> to wrap.</param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the wrapped string representation.</returns>
|
||||
HtmlString Raw(object value);
|
||||
/// <returns><see cref="IHtmlContent"/> containing the wrapped string representation.</returns>
|
||||
IHtmlContent Raw(object value);
|
||||
|
||||
/// <summary>
|
||||
/// Renders HTML markup for the specified partial view.
|
||||
|
|
@ -641,8 +636,8 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// An <see cref="object"/> that contains the HTML attributes for the element. Alternatively, an
|
||||
/// <see cref="IDictionary{string, object}"/> instance containing the HTML attributes.
|
||||
/// </param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the anchor element.</returns>
|
||||
HtmlString RouteLink(
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the anchor element.</returns>
|
||||
IHtmlContent RouteLink(
|
||||
[NotNull] string linkText,
|
||||
string routeName,
|
||||
string protocol,
|
||||
|
|
@ -662,7 +657,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// An <see cref="object"/> that contains the HTML attributes for the element. Alternatively, an
|
||||
/// <see cref="IDictionary{string, object}"/> instance containing the HTML attributes.
|
||||
/// </param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <textarea> element.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <textarea> element.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Combines <see cref="TemplateInfo.HtmlFieldPrefix"/> and <paramref name="expression"/> to set
|
||||
|
|
@ -689,7 +684,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <item>Otherwise, <c>string.Empty</c>.</item>
|
||||
/// </list>
|
||||
/// </remarks>
|
||||
HtmlString TextArea(string expression, string value, int rows, int columns, object htmlAttributes);
|
||||
IHtmlContent TextArea(string expression, string value, int rows, int columns, object htmlAttributes);
|
||||
|
||||
/// <summary>
|
||||
/// Returns an <input> element of type "text" for the specified <paramref name="current"/>.
|
||||
|
|
@ -703,7 +698,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// An <see cref="object"/> that contains the HTML attributes for the element. Alternatively, an
|
||||
/// <see cref="IDictionary{string, object}"/> instance containing the HTML attributes.
|
||||
/// </param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <input> element.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <input> element.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Combines <see cref="TemplateInfo.HtmlFieldPrefix"/> and <paramref name="current"/> to set
|
||||
|
|
@ -737,7 +732,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <item>Otherwise, <c>string.Empty</c>.</item>
|
||||
/// </list>
|
||||
/// </remarks>
|
||||
HtmlString TextBox(string current, object value, string format, object htmlAttributes);
|
||||
IHtmlContent TextBox(string current, object value, string format, object htmlAttributes);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the validation message if an error exists in the <see cref="ModelStateDictionary"/> object
|
||||
|
|
@ -758,10 +753,10 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <see cref="ViewContext.ValidationMessageElement"/>.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A new <see cref="HtmlString"/> containing a <paramref name="tag"/> element. <c>null</c> if the
|
||||
/// A new <see cref="IHtmlContent"/> containing a <paramref name="tag"/> element. <c>null</c> if the
|
||||
/// <paramref name="expression"/> is valid and client-side validation is disabled.
|
||||
/// </returns>
|
||||
HtmlString ValidationMessage(string expression, string message, object htmlAttributes, string tag);
|
||||
IHtmlContent ValidationMessage(string expression, string message, object htmlAttributes, string tag);
|
||||
|
||||
/// <summary>
|
||||
/// Returns an unordered list (<ul> element) of validation messages that are in the
|
||||
|
|
@ -780,11 +775,11 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <see cref="ViewContext.ValidationSummaryMessageElement" />.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// New <see cref="HtmlString"/> containing a <div> element wrapping the <paramref name="tag"/> element
|
||||
/// New <see cref="IHtmlContent"/> containing a <div> element wrapping the <paramref name="tag"/> element
|
||||
/// and the <ul> element. <see cref="HtmlString.Empty"/> if the current model is valid and client-side
|
||||
/// validation is disabled).
|
||||
/// </returns>
|
||||
HtmlString ValidationSummary(
|
||||
IHtmlContent ValidationSummary(
|
||||
bool excludePropertyErrors,
|
||||
string message,
|
||||
object htmlAttributes,
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq.Expressions;
|
||||
using Microsoft.AspNet.Html.Abstractions;
|
||||
using Microsoft.Framework.Internal;
|
||||
|
||||
namespace Microsoft.AspNet.Mvc.Rendering
|
||||
|
|
@ -28,7 +29,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// An <see cref="object"/> that contains the HTML attributes for the checkbox element. Alternatively, an
|
||||
/// <see cref="IDictionary{string, object}"/> instance containing the HTML attributes.
|
||||
/// </param>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <input> elements.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <input> elements.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Combines <see cref="TemplateInfo.HtmlFieldPrefix"/> and the string representation of the
|
||||
|
|
@ -53,7 +54,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// if the <see cref="bool"/> values is <c>true</c>; does not include the attribute otherwise.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
HtmlString CheckBoxFor([NotNull] Expression<Func<TModel, bool>> expression, object htmlAttributes);
|
||||
IHtmlContent CheckBoxFor([NotNull] Expression<Func<TModel, bool>> expression, object htmlAttributes);
|
||||
|
||||
/// <summary>
|
||||
/// Returns HTML markup for the <paramref name="expression"/>, using a display template, specified HTML field
|
||||
|
|
@ -72,12 +73,12 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// template.
|
||||
/// </param>
|
||||
/// <typeparam name="TResult">The type of the <paramref name="expression"/> result.</typeparam>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the created HTML.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the created HTML.</returns>
|
||||
/// <remarks>
|
||||
/// For example the default <see cref="object"/> display template includes markup for each property in the
|
||||
/// <paramref name="expression"/> result.
|
||||
/// </remarks>
|
||||
HtmlString DisplayFor<TResult>(
|
||||
IHtmlContent DisplayFor<TResult>(
|
||||
[NotNull] Expression<Func<TModel, TResult>> expression,
|
||||
string templateName,
|
||||
string htmlFieldName,
|
||||
|
|
@ -131,13 +132,13 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <see cref="IDictionary{string, object}"/> instance containing the HTML attributes.
|
||||
/// </param>
|
||||
/// <typeparam name="TResult">The type of the <paramref name="expression"/> result.</typeparam>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <select> element.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <select> element.</returns>
|
||||
/// <remarks>
|
||||
/// Combines <see cref="TemplateInfo.HtmlFieldPrefix"/> and the string representation of the
|
||||
/// <paramref name="expression"/> to set <select> element's "name" attribute. Sanitizes the string
|
||||
/// representation of the <paramref name="expression"/> to set element's "id" attribute.
|
||||
/// </remarks>
|
||||
HtmlString DropDownListFor<TResult>(
|
||||
IHtmlContent DropDownListFor<TResult>(
|
||||
[NotNull] Expression<Func<TModel, TResult>> expression,
|
||||
IEnumerable<SelectListItem> selectList,
|
||||
string optionLabel,
|
||||
|
|
@ -160,12 +161,12 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// template.
|
||||
/// </param>
|
||||
/// <typeparam name="TResult">The type of the <paramref name="expression"/> result.</typeparam>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <input> element(s).</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <input> element(s).</returns>
|
||||
/// <remarks>
|
||||
/// For example the default <see cref="object"/> editor template includes <label> and <input>
|
||||
/// elements for each property in the <paramref name="expression"/> result.
|
||||
/// </remarks>
|
||||
HtmlString EditorFor<TResult>(
|
||||
IHtmlContent EditorFor<TResult>(
|
||||
[NotNull] Expression<Func<TModel, TResult>> expression,
|
||||
string templateName,
|
||||
string htmlFieldName,
|
||||
|
|
@ -186,7 +187,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <see cref="IDictionary{string, object}"/> instance containing the HTML attributes.
|
||||
/// </param>
|
||||
/// <typeparam name="TResult">The type of the <paramref name="expression"/> result.</typeparam>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <input> element.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <input> element.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Combines <see cref="TemplateInfo.HtmlFieldPrefix"/> and the string representation of the
|
||||
|
|
@ -207,7 +208,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <item>Otherwise, <c>string.Empty</c>.</item>
|
||||
/// </list>
|
||||
/// </remarks>
|
||||
HtmlString HiddenFor<TResult>(
|
||||
IHtmlContent HiddenFor<TResult>(
|
||||
[NotNull] Expression<Func<TModel, TResult>> expression,
|
||||
object htmlAttributes);
|
||||
|
||||
|
|
@ -229,8 +230,8 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <see cref="IDictionary{string, object}"/> instance containing the HTML attributes.
|
||||
/// </param>
|
||||
/// <typeparam name="TResult">The type of the <paramref name="expression"/> result.</typeparam>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <label> element.</returns>
|
||||
HtmlString LabelFor<TResult>(
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <label> element.</returns>
|
||||
IHtmlContent LabelFor<TResult>(
|
||||
[NotNull] Expression<Func<TModel, TResult>> expression,
|
||||
string labelText,
|
||||
object htmlAttributes);
|
||||
|
|
@ -249,13 +250,13 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <see cref="IDictionary{string, object}"/> instance containing the HTML attributes.
|
||||
/// </param>
|
||||
/// <typeparam name="TResult">The type of the <paramref name="expression"/> result.</typeparam>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <select> element.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <select> element.</returns>
|
||||
/// <remarks>
|
||||
/// Combines <see cref="TemplateInfo.HtmlFieldPrefix"/> and the string representation of the
|
||||
/// <paramref name="expression"/> to set <select> element's "name" attribute. Sanitizes the string
|
||||
/// representation of the <paramref name="expression"/> to set element's "id" attribute.
|
||||
/// </remarks>
|
||||
HtmlString ListBoxFor<TResult>(
|
||||
IHtmlContent ListBoxFor<TResult>(
|
||||
[NotNull] Expression<Func<TModel, TResult>> expression,
|
||||
IEnumerable<SelectListItem> selectList,
|
||||
object htmlAttributes);
|
||||
|
|
@ -277,7 +278,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <see cref="IDictionary{string, object}"/> instance containing the HTML attributes.
|
||||
/// </param>
|
||||
/// <typeparam name="TResult">The type of the <paramref name="expression"/> result.</typeparam>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <input> element.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <input> element.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Combines <see cref="TemplateInfo.HtmlFieldPrefix"/> and the string representation of the
|
||||
|
|
@ -294,7 +295,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <item>Otherwise, <c>string.Empty</c>.</item>
|
||||
/// </list>
|
||||
/// </remarks>
|
||||
HtmlString PasswordFor<TResult>(
|
||||
IHtmlContent PasswordFor<TResult>(
|
||||
[NotNull] Expression<Func<TModel, TResult>> expression,
|
||||
object htmlAttributes);
|
||||
|
||||
|
|
@ -308,7 +309,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <see cref="IDictionary{string, object}"/> instance containing the HTML attributes.
|
||||
/// </param>
|
||||
/// <typeparam name="TResult">The type of the <paramref name="expression"/> result.</typeparam>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <input> element.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <input> element.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Combines <see cref="TemplateInfo.HtmlFieldPrefix"/> and the string representation of the
|
||||
|
|
@ -334,16 +335,16 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <paramref name="value"/>; does not include the attribute otherwise.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
HtmlString RadioButtonFor<TResult>(
|
||||
IHtmlContent RadioButtonFor<TResult>(
|
||||
[NotNull] Expression<Func<TModel, TResult>> expression,
|
||||
[NotNull] object value,
|
||||
object htmlAttributes);
|
||||
|
||||
/// <inheritdoc cref="IHtmlHelper.Raw(object)"/>
|
||||
new HtmlString Raw(object value);
|
||||
new IHtmlContent Raw(object value);
|
||||
|
||||
/// <inheritdoc cref="IHtmlHelper.Raw(string)"/>
|
||||
new HtmlString Raw(string value);
|
||||
new IHtmlContent Raw(string value);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a <textarea> element for the specified <paramref name="expression"/>.
|
||||
|
|
@ -356,7 +357,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <see cref="IDictionary{string, object}"/> instance containing the HTML attributes.
|
||||
/// </param>
|
||||
/// <typeparam name="TResult">The type of the <paramref name="expression"/> result.</typeparam>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <textarea> element.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <textarea> element.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Combines <see cref="TemplateInfo.HtmlFieldPrefix"/> and the string representation of the
|
||||
|
|
@ -375,7 +376,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <item>Otherwise, <c>string.Empty</c>.</item>
|
||||
/// </list>
|
||||
/// </remarks>
|
||||
HtmlString TextAreaFor<TResult>(
|
||||
IHtmlContent TextAreaFor<TResult>(
|
||||
[NotNull] Expression<Func<TModel, TResult>> expression,
|
||||
int rows,
|
||||
int columns,
|
||||
|
|
@ -393,7 +394,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <see cref="IDictionary{string, object}"/> instance containing the HTML attributes.
|
||||
/// </param>
|
||||
/// <typeparam name="TResult">The type of the <paramref name="expression"/> result.</typeparam>
|
||||
/// <returns>A new <see cref="HtmlString"/> containing the <input> element.</returns>
|
||||
/// <returns>A new <see cref="IHtmlContent"/> containing the <input> element.</returns>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Combines <see cref="TemplateInfo.HtmlFieldPrefix"/> and the string representation of the
|
||||
|
|
@ -415,7 +416,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <item>Otherwise, <c>string.Empty</c>.</item>
|
||||
/// </list>
|
||||
/// </remarks>
|
||||
HtmlString TextBoxFor<TResult>(
|
||||
IHtmlContent TextBoxFor<TResult>(
|
||||
[NotNull] Expression<Func<TModel, TResult>> expression,
|
||||
string format,
|
||||
object htmlAttributes);
|
||||
|
|
@ -440,10 +441,10 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// </param>
|
||||
/// <typeparam name="TResult">The type of the <paramref name="expression"/> result.</typeparam>
|
||||
/// <returns>
|
||||
/// A new <see cref="HtmlString"/> containing the <paramref name="tag"/> element. <c>null</c> if the
|
||||
/// A new <see cref="IHtmlContent"/> containing the <paramref name="tag"/> element. <c>null</c> if the
|
||||
/// <paramref name="expression"/> is valid and client-side validation is disabled.
|
||||
/// </returns>
|
||||
HtmlString ValidationMessageFor<TResult>(
|
||||
IHtmlContent ValidationMessageFor<TResult>(
|
||||
[NotNull] Expression<Func<TModel, TResult>> expression,
|
||||
string message,
|
||||
object htmlAttributes,
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System.Globalization;
|
||||
using Microsoft.AspNet.Html.Abstractions;
|
||||
using Microsoft.AspNet.Mvc.ModelBinding;
|
||||
using Microsoft.Framework.Internal;
|
||||
|
||||
|
|
@ -42,7 +43,7 @@ namespace Microsoft.AspNet.Mvc.Rendering.Internal
|
|||
_metadata = modelExplorer.Metadata;
|
||||
}
|
||||
|
||||
public string Build()
|
||||
public IHtmlContent Build()
|
||||
{
|
||||
if (_metadata.ConvertEmptyStringToNull && string.Empty.Equals(_model))
|
||||
{
|
||||
|
|
@ -66,7 +67,7 @@ namespace Microsoft.AspNet.Mvc.Rendering.Internal
|
|||
// don't check to make sure that the object hasn't already been displayed
|
||||
if (_viewData.TemplateInfo.Visited(_modelExplorer))
|
||||
{
|
||||
return string.Empty;
|
||||
return HtmlString.Empty;
|
||||
}
|
||||
|
||||
// We need to copy the ModelExplorer to copy the model metadata. Otherwise we might
|
||||
|
|
|
|||
|
|
@ -4,10 +4,9 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Microsoft.AspNet.Html.Abstractions;
|
||||
using Microsoft.AspNet.Http;
|
||||
using Microsoft.AspNet.Mvc.ModelBinding;
|
||||
using Microsoft.AspNet.Mvc.ViewFeatures;
|
||||
|
|
@ -22,8 +21,8 @@ namespace Microsoft.AspNet.Mvc.Rendering.Internal
|
|||
private const string EditorTemplateViewPath = "EditorTemplates";
|
||||
public const string IEnumerableOfIFormFileName = "IEnumerable`" + nameof(IFormFile);
|
||||
|
||||
private static readonly Dictionary<string, Func<IHtmlHelper, string>> _defaultDisplayActions =
|
||||
new Dictionary<string, Func<IHtmlHelper, string>>(StringComparer.OrdinalIgnoreCase)
|
||||
private static readonly Dictionary<string, Func<IHtmlHelper, IHtmlContent>> _defaultDisplayActions =
|
||||
new Dictionary<string, Func<IHtmlHelper, IHtmlContent>>(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
{ "Collection", DefaultDisplayTemplates.CollectionTemplate },
|
||||
{ "EmailAddress", DefaultDisplayTemplates.EmailAddressTemplate },
|
||||
|
|
@ -37,8 +36,8 @@ namespace Microsoft.AspNet.Mvc.Rendering.Internal
|
|||
{ typeof(object).Name, DefaultDisplayTemplates.ObjectTemplate },
|
||||
};
|
||||
|
||||
private static readonly Dictionary<string, Func<IHtmlHelper, string>> _defaultEditorActions =
|
||||
new Dictionary<string, Func<IHtmlHelper, string>>(StringComparer.OrdinalIgnoreCase)
|
||||
private static readonly Dictionary<string, Func<IHtmlHelper, IHtmlContent>> _defaultEditorActions =
|
||||
new Dictionary<string, Func<IHtmlHelper, IHtmlContent>>(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
{ "Collection", DefaultEditorTemplates.CollectionTemplate },
|
||||
{ "EmailAddress", DefaultEditorTemplates.EmailAddressInputTemplate },
|
||||
|
|
@ -88,7 +87,7 @@ namespace Microsoft.AspNet.Mvc.Rendering.Internal
|
|||
_readOnly = readOnly;
|
||||
}
|
||||
|
||||
public string Render()
|
||||
public IHtmlContent Render()
|
||||
{
|
||||
var defaultActions = GetDefaultActions();
|
||||
var modeViewPath = _readOnly ? DisplayTemplateViewPath : EditorTemplateViewPath;
|
||||
|
|
@ -100,7 +99,7 @@ namespace Microsoft.AspNet.Mvc.Rendering.Internal
|
|||
var viewEngineResult = _viewEngine.FindPartialView(_viewContext, fullViewName);
|
||||
if (viewEngineResult.Success)
|
||||
{
|
||||
using (var writer = new StringWriter(CultureInfo.InvariantCulture))
|
||||
using (var writer = new StringCollectionTextWriter(_viewContext.Writer.Encoding))
|
||||
{
|
||||
// Forcing synchronous behavior so users don't have to await templates.
|
||||
var view = viewEngineResult.View;
|
||||
|
|
@ -109,12 +108,12 @@ namespace Microsoft.AspNet.Mvc.Rendering.Internal
|
|||
var viewContext = new ViewContext(_viewContext, viewEngineResult.View, _viewData, writer);
|
||||
var renderTask = viewEngineResult.View.RenderAsync(viewContext);
|
||||
renderTask.GetAwaiter().GetResult();
|
||||
return writer.ToString();
|
||||
return writer.Content;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Func<IHtmlHelper, string> defaultAction;
|
||||
Func<IHtmlHelper, IHtmlContent> defaultAction;
|
||||
if (defaultActions.TryGetValue(viewName, out defaultAction))
|
||||
{
|
||||
return defaultAction(MakeHtmlHelper(_viewContext, _viewData));
|
||||
|
|
@ -125,7 +124,7 @@ namespace Microsoft.AspNet.Mvc.Rendering.Internal
|
|||
Resources.FormatTemplateHelpers_NoTemplate(_viewData.ModelExplorer.ModelType.FullName));
|
||||
}
|
||||
|
||||
private Dictionary<string, Func<IHtmlHelper, string>> GetDefaultActions()
|
||||
private Dictionary<string, Func<IHtmlHelper, IHtmlContent>> GetDefaultActions()
|
||||
{
|
||||
return _readOnly ? _defaultDisplayActions : _defaultEditorActions;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -172,7 +172,11 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
/// <inheritdoc />
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Join(string.Empty, Content);
|
||||
using (var writer = new StringWriter())
|
||||
{
|
||||
Content.WriteTo(writer, HtmlEncoder.Default);
|
||||
return writer.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
// 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 System.IO;
|
||||
using Microsoft.AspNet.Html.Abstractions;
|
||||
using Microsoft.Framework.Internal;
|
||||
using Microsoft.Framework.WebEncoders;
|
||||
|
||||
namespace Microsoft.AspNet.Mvc.Rendering
|
||||
{
|
||||
/// <summary>
|
||||
/// String content which gets encoded when written.
|
||||
/// </summary>
|
||||
public class StringHtmlContent : IHtmlContent
|
||||
{
|
||||
private readonly string _input;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance of <see cref="StringHtmlContent"/>
|
||||
/// </summary>
|
||||
/// <param name="input"><see cref="string"/> to be HTML encoded when <see cref="WriteTo"/> is called.</param>
|
||||
public StringHtmlContent(string input)
|
||||
{
|
||||
_input = input;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void WriteTo([NotNull] TextWriter writer, [NotNull] IHtmlEncoder encoder)
|
||||
{
|
||||
encoder.HtmlEncode(_input, writer);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string ToString()
|
||||
{
|
||||
return _input;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -15,6 +15,7 @@
|
|||
"Microsoft.AspNet.Mvc.Core": "6.0.0-*",
|
||||
"Microsoft.AspNet.Mvc.DataAnnotations": "6.0.0-*",
|
||||
"Microsoft.AspNet.Mvc.Formatters.Json": "6.0.0-*",
|
||||
"Microsoft.Framework.BufferedHtmlContent.Sources": { "version": "1.0.0-*", "type": "build" },
|
||||
"Microsoft.Framework.ClosedGenericMatcher.Sources": { "version": "1.0.0-*", "type": "build" },
|
||||
"Microsoft.Framework.CopyOnWriteDictionary.Sources": { "version": "1.0.0-*", "type": "build" },
|
||||
"Microsoft.Framework.NotNullAttribute.Sources": { "version": "1.0.0-*", "type": "build" },
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
"Microsoft.AspNet.Mvc.Formatters.Xml": "6.0.0-*",
|
||||
"Microsoft.AspNet.Testing": "1.0.0-*",
|
||||
"Microsoft.Framework.Logging.Testing": "1.0.0-*",
|
||||
"Microsoft.Framework.WebEncoders.Testing": "1.0.0-*",
|
||||
"Moq": "4.2.1312.1622",
|
||||
"xunit.runner.aspnet": "2.0.0-aspnet-*"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@
|
|||
"Microsoft.AspNet.TestHost": "1.0.0-*",
|
||||
"Microsoft.AspNet.WebUtilities": "1.0.0-*",
|
||||
"Microsoft.Framework.Configuration.Json": "1.0.0-*",
|
||||
"Microsoft.Framework.WebEncoders.Testing": "1.0.0-*",
|
||||
"ModelBindingWebSite": "1.0.0",
|
||||
"MvcSample.Web": "1.0.0",
|
||||
"PrecompilationWebSite": "1.0.0",
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
"type": "build"
|
||||
},
|
||||
"Microsoft.AspNet.Testing": "1.0.0-*",
|
||||
"Microsoft.Framework.WebEncoders.Testing": "1.0.0-*",
|
||||
"xunit.runner.aspnet": "2.0.0-aspnet-*"
|
||||
},
|
||||
"commands": {
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
"Microsoft.AspNet.Mvc.ViewFeatures": "6.0.0-*",
|
||||
"Microsoft.AspNet.Mvc.TestCommon": { "version": "6.0.0-*", "type": "build" },
|
||||
"Microsoft.AspNet.Testing": "1.0.0-*",
|
||||
"Microsoft.Framework.WebEncoders.Testing": "1.0.0-*",
|
||||
"xunit.runner.aspnet": "2.0.0-aspnet-*"
|
||||
},
|
||||
"commands": {
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.Http.Internal;
|
||||
using Microsoft.AspNet.Mvc.Rendering;
|
||||
using Microsoft.AspNet.Mvc.TestCommon;
|
||||
using Microsoft.AspNet.PageExecutionInstrumentation;
|
||||
using Microsoft.AspNet.Razor.Runtime.TagHelpers;
|
||||
using Microsoft.AspNet.Testing;
|
||||
|
|
@ -181,7 +181,9 @@ namespace Microsoft.AspNet.Mvc.Razor
|
|||
// Assert
|
||||
var content = Assert.IsType<DefaultTagHelperContent>(returnValue);
|
||||
Assert.Equal("HtmlEncode[[Hello ]]HtmlEncode[[World!]]", content.GetContent());
|
||||
Assert.Equal(new[] { "HtmlEncode[[Hello ]]", "HtmlEncode[[World!]]" }, content.ToArray());
|
||||
Assert.Equal(
|
||||
"HtmlEncode[[Hello ]]HtmlEncode[[World!]]",
|
||||
HtmlContentUtilities.HtmlContentToString(content));
|
||||
}, viewContext);
|
||||
await page.ExecuteAsync();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
"hello=world",
|
||||
It.IsAny<IDictionary<string, object>>(),
|
||||
null))
|
||||
.Returns(new TagBuilder("a", new CommonTestEncoder()))
|
||||
.Returns(new TagBuilder("a"))
|
||||
.Verifiable();
|
||||
var anchorTagHelper = new AnchorTagHelper(generator.Object)
|
||||
{
|
||||
|
|
@ -163,7 +163,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
"hello=world",
|
||||
It.IsAny<IDictionary<string, object>>(),
|
||||
null))
|
||||
.Returns(new TagBuilder("a", new CommonTestEncoder()))
|
||||
.Returns(new TagBuilder("a"))
|
||||
.Verifiable();
|
||||
var anchorTagHelper = new AnchorTagHelper(generator.Object)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
It.IsAny<object>(),
|
||||
It.IsAny<string>(),
|
||||
It.IsAny<object>()))
|
||||
.Returns(new TagBuilder("form", new CommonTestEncoder()));
|
||||
.Returns(new TagBuilder("form"));
|
||||
|
||||
generator.Setup(mock => mock.GenerateAntiforgery(viewContext))
|
||||
.Returns(new HtmlString("<input />"));
|
||||
|
|
@ -189,7 +189,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
routeValue = Assert.Single(routeValueDictionary, attr => attr.Key.Equals("-Name"));
|
||||
Assert.Equal("Value", routeValue.Value);
|
||||
})
|
||||
.Returns(new TagBuilder("form", new CommonTestEncoder()))
|
||||
.Returns(new TagBuilder("form"))
|
||||
.Verifiable();
|
||||
var formTagHelper = new FormTagHelper(generator.Object)
|
||||
{
|
||||
|
|
@ -244,7 +244,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
It.IsAny<IDictionary<string, object>>(),
|
||||
null,
|
||||
null))
|
||||
.Returns(new TagBuilder("form", new CommonTestEncoder()))
|
||||
.Returns(new TagBuilder("form"))
|
||||
.Verifiable();
|
||||
var formTagHelper = new FormTagHelper(generator.Object)
|
||||
{
|
||||
|
|
@ -294,7 +294,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
It.Is<Dictionary<string, object>>(m => string.Equals(m["name"], "value")),
|
||||
null,
|
||||
null))
|
||||
.Returns(new TagBuilder("form", new CommonTestEncoder()))
|
||||
.Returns(new TagBuilder("form"))
|
||||
.Verifiable();
|
||||
var formTagHelper = new FormTagHelper(generator.Object)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,12 +4,15 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.Html.Abstractions;
|
||||
using Microsoft.AspNet.Http;
|
||||
using Microsoft.AspNet.Mvc.ModelBinding;
|
||||
using Microsoft.AspNet.Mvc.Rendering;
|
||||
using Microsoft.AspNet.Mvc.Rendering.Internal;
|
||||
using Microsoft.AspNet.Mvc.TestCommon;
|
||||
using Microsoft.AspNet.Razor.Runtime.TagHelpers;
|
||||
using Microsoft.Framework.WebEncoders.Testing;
|
||||
using Moq;
|
||||
|
|
@ -104,7 +107,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
|
||||
// Assert
|
||||
Assert.Empty(output.Attributes); // Moved to Content and cleared
|
||||
Assert.Equal(expectedContent, output.Content.GetContent());
|
||||
Assert.Equal(expectedContent, HtmlContentUtilities.HtmlContentToString(output.Content));
|
||||
Assert.True(output.SelfClosing);
|
||||
Assert.Null(output.TagName); // Cleared
|
||||
}
|
||||
|
|
@ -276,7 +279,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
|
||||
var htmlGenerator = new Mock<IHtmlGenerator>(MockBehavior.Strict);
|
||||
var tagHelper = GetTagHelper(htmlGenerator.Object, model: false, propertyName: nameof(Model.IsACar));
|
||||
var tagBuilder = new TagBuilder("input", new CommonTestEncoder())
|
||||
var tagBuilder = new TagBuilder("input")
|
||||
{
|
||||
Attributes =
|
||||
{
|
||||
|
|
@ -297,7 +300,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
tagHelper.ViewContext,
|
||||
tagHelper.For.ModelExplorer,
|
||||
tagHelper.For.Name))
|
||||
.Returns(new TagBuilder("hidden", new NullTestEncoder()))
|
||||
.Returns(new TagBuilder("hidden"))
|
||||
.Verifiable();
|
||||
|
||||
// Act
|
||||
|
|
@ -308,7 +311,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
|
||||
Assert.Empty(output.Attributes); // Moved to Content and cleared
|
||||
Assert.Equal(expectedPreContent, output.PreContent.GetContent());
|
||||
Assert.Equal(expectedContent, output.Content.GetContent());
|
||||
Assert.Equal(expectedContent, HtmlContentUtilities.HtmlContentToString(output.Content));
|
||||
Assert.Equal(expectedPostContent, output.PostContent.GetContent());
|
||||
Assert.True(output.SelfClosing);
|
||||
Assert.Null(output.TagName); // Cleared
|
||||
|
|
@ -381,7 +384,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
metadataProvider: metadataProvider);
|
||||
tagHelper.InputTypeName = inputTypeName;
|
||||
|
||||
var tagBuilder = new TagBuilder("input", new NullTestEncoder())
|
||||
var tagBuilder = new TagBuilder("input")
|
||||
{
|
||||
Attributes =
|
||||
{
|
||||
|
|
@ -480,7 +483,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
metadataProvider: metadataProvider);
|
||||
tagHelper.InputTypeName = inputTypeName;
|
||||
|
||||
var tagBuilder = new TagBuilder("input", new NullTestEncoder())
|
||||
var tagBuilder = new TagBuilder("input")
|
||||
{
|
||||
Attributes =
|
||||
{
|
||||
|
|
@ -570,7 +573,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
tagHelper.InputTypeName = inputTypeName;
|
||||
tagHelper.Value = value;
|
||||
|
||||
var tagBuilder = new TagBuilder("input", new NullTestEncoder())
|
||||
var tagBuilder = new TagBuilder("input")
|
||||
{
|
||||
Attributes =
|
||||
{
|
||||
|
|
@ -683,7 +686,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
metadataProvider: metadataProvider);
|
||||
tagHelper.InputTypeName = inputTypeName;
|
||||
|
||||
var tagBuilder = new TagBuilder("input", new NullTestEncoder())
|
||||
var tagBuilder = new TagBuilder("input")
|
||||
{
|
||||
Attributes =
|
||||
{
|
||||
|
|
@ -791,7 +794,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
propertyName: nameof(Model.Text),
|
||||
metadataProvider: metadataProvider);
|
||||
|
||||
var tagBuilder = new TagBuilder("input", new NullTestEncoder());
|
||||
var tagBuilder = new TagBuilder("input");
|
||||
|
||||
var htmlAttributes = new Dictionary<string, object>
|
||||
{
|
||||
|
|
@ -820,9 +823,9 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
|
||||
Assert.True(output.SelfClosing);
|
||||
Assert.Equal(expectedAttributes, output.Attributes);
|
||||
Assert.Empty(output.PreContent);
|
||||
Assert.Equal(new[] { string.Empty }, output.Content);
|
||||
Assert.Empty(output.PostContent);
|
||||
Assert.Empty(output.PreContent.GetContent());
|
||||
Assert.Equal(string.Empty, output.Content.GetContent());
|
||||
Assert.Empty(output.PostContent.GetContent());
|
||||
Assert.Equal(expectedTagName, output.TagName);
|
||||
}
|
||||
|
||||
|
|
@ -875,7 +878,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
metadataProvider: metadataProvider);
|
||||
tagHelper.ViewContext.Html5DateRenderingMode = dateRenderingMode;
|
||||
|
||||
var tagBuilder = new TagBuilder("input", new NullTestEncoder());
|
||||
var tagBuilder = new TagBuilder("input");
|
||||
htmlGenerator
|
||||
.Setup(mock => mock.GenerateTextBox(
|
||||
tagHelper.ViewContext,
|
||||
|
|
@ -895,9 +898,9 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
|
||||
Assert.True(output.SelfClosing);
|
||||
Assert.Equal(expectedAttributes, output.Attributes);
|
||||
Assert.Empty(output.PreContent);
|
||||
Assert.Equal(new[] { string.Empty }, output.Content);
|
||||
Assert.Empty(output.PostContent);
|
||||
Assert.Empty(output.PreContent.GetContent());
|
||||
Assert.Equal(string.Empty, output.Content.GetContent());
|
||||
Assert.Empty(output.PostContent.GetContent());
|
||||
Assert.Equal(expectedTagName, output.TagName);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ using System.Linq;
|
|||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.Mvc.ModelBinding;
|
||||
using Microsoft.AspNet.Mvc.Rendering;
|
||||
using Microsoft.AspNet.Mvc.TestCommon;
|
||||
using Microsoft.AspNet.Razor.Runtime.TagHelpers;
|
||||
using Xunit;
|
||||
|
||||
|
|
@ -222,7 +223,9 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
// Assert
|
||||
Assert.Equal(expectedAttributes, output.Attributes);
|
||||
Assert.Equal(expectedPreContent, output.PreContent.GetContent());
|
||||
Assert.Equal(tagHelperOutputContent.ExpectedContent, output.Content.GetContent());
|
||||
Assert.Equal(
|
||||
tagHelperOutputContent.ExpectedContent,
|
||||
HtmlContentUtilities.HtmlContentToString(output.Content));
|
||||
Assert.Equal(expectedPostContent, output.PostContent.GetContent());
|
||||
Assert.False(output.SelfClosing);
|
||||
Assert.Equal(expectedTagName, output.TagName);
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ using System.Linq;
|
|||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.Mvc.ModelBinding;
|
||||
using Microsoft.AspNet.Mvc.Rendering;
|
||||
using Microsoft.AspNet.Mvc.TestCommon;
|
||||
using Microsoft.AspNet.Razor.Runtime.TagHelpers;
|
||||
using Moq;
|
||||
using Xunit;
|
||||
|
|
@ -334,7 +335,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
Assert.Equal(expectedAttributes, output.Attributes);
|
||||
Assert.Equal(expectedPreContent, output.PreContent.GetContent());
|
||||
Assert.Equal(expectedContent, output.Content.GetContent());
|
||||
Assert.Equal(expectedPostContent, output.PostContent.GetContent());
|
||||
Assert.Equal(expectedPostContent, HtmlContentUtilities.HtmlContentToString(output.PostContent));
|
||||
Assert.Equal(expectedTagName, output.TagName);
|
||||
|
||||
Assert.NotNull(viewContext.FormContext?.FormData);
|
||||
|
|
@ -437,7 +438,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
Assert.Equal(expectedAttributes, output.Attributes);
|
||||
Assert.Equal(expectedPreContent, output.PreContent.GetContent());
|
||||
Assert.Equal(expectedContent, output.Content.GetContent());
|
||||
Assert.Equal(expectedPostContent, output.PostContent.GetContent());
|
||||
Assert.Equal(expectedPostContent, HtmlContentUtilities.HtmlContentToString(output.PostContent));
|
||||
Assert.Equal(expectedTagName, output.TagName);
|
||||
|
||||
Assert.NotNull(viewContext.FormContext?.FormData);
|
||||
|
|
|
|||
|
|
@ -425,7 +425,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
// Arrange
|
||||
var tagHelperOutput = new TagHelperOutput("p", outputAttributes);
|
||||
|
||||
var tagBuilder = new TagBuilder("p", new CommonTestEncoder());
|
||||
var tagBuilder = new TagBuilder("p");
|
||||
foreach (var attr in tagBuilderAttributes)
|
||||
{
|
||||
tagBuilder.Attributes.Add(attr.Key, attr.Value);
|
||||
|
|
@ -451,7 +451,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
var expectedAttribute = new TagHelperAttribute("type", "btn");
|
||||
tagHelperOutput.Attributes.Add(expectedAttribute);
|
||||
|
||||
var tagBuilder = new TagBuilder("p", new CommonTestEncoder());
|
||||
var tagBuilder = new TagBuilder("p");
|
||||
tagBuilder.Attributes.Add("type", "hello");
|
||||
|
||||
// Act
|
||||
|
|
@ -471,7 +471,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
attributes: new TagHelperAttributeList());
|
||||
tagHelperOutput.Attributes.Add("class", "Hello");
|
||||
|
||||
var tagBuilder = new TagBuilder("p", new CommonTestEncoder());
|
||||
var tagBuilder = new TagBuilder("p");
|
||||
tagBuilder.Attributes.Add("class", "btn");
|
||||
|
||||
var expectedAttribute = new TagHelperAttribute("class", "Hello btn");
|
||||
|
|
@ -497,7 +497,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
attributes: new TagHelperAttributeList());
|
||||
tagHelperOutput.Attributes.Add(originalName, "Hello");
|
||||
|
||||
var tagBuilder = new TagBuilder("p", new CommonTestEncoder());
|
||||
var tagBuilder = new TagBuilder("p");
|
||||
tagBuilder.Attributes.Add(updateName, "btn");
|
||||
|
||||
// Act
|
||||
|
|
@ -516,7 +516,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
"p",
|
||||
attributes: new TagHelperAttributeList());
|
||||
|
||||
var tagBuilder = new TagBuilder("p", new CommonTestEncoder());
|
||||
var tagBuilder = new TagBuilder("p");
|
||||
var expectedAttribute = new TagHelperAttribute("visible", "val < 3");
|
||||
tagBuilder.Attributes.Add("visible", "val < 3");
|
||||
|
||||
|
|
@ -536,7 +536,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
"p",
|
||||
attributes: new TagHelperAttributeList());
|
||||
|
||||
var tagBuilder = new TagBuilder("p", new CommonTestEncoder());
|
||||
var tagBuilder = new TagBuilder("p");
|
||||
var expectedAttribute1 = new TagHelperAttribute("class", "btn");
|
||||
var expectedAttribute2 = new TagHelperAttribute("class2", "btn");
|
||||
tagBuilder.Attributes.Add("class", "btn");
|
||||
|
|
@ -563,7 +563,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
var expectedAttribute = new TagHelperAttribute("class", "btn");
|
||||
tagHelperOutput.Attributes.Add(expectedAttribute);
|
||||
|
||||
var tagBuilder = new TagBuilder("p", new CommonTestEncoder());
|
||||
var tagBuilder = new TagBuilder("p");
|
||||
|
||||
// Act
|
||||
tagHelperOutput.MergeAttributes(tagBuilder);
|
||||
|
|
@ -583,7 +583,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
var expectedOutputAttribute = new TagHelperAttribute("class", "btn");
|
||||
tagHelperOutput.Attributes.Add(expectedOutputAttribute);
|
||||
|
||||
var tagBuilder = new TagBuilder("p", new CommonTestEncoder());
|
||||
var tagBuilder = new TagBuilder("p");
|
||||
var expectedBuilderAttribute = new TagHelperAttribute("for", "hello");
|
||||
tagBuilder.Attributes.Add("for", "hello");
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ using System.Collections.Generic;
|
|||
using System.IO;
|
||||
using Microsoft.AspNet.Antiforgery;
|
||||
using Microsoft.AspNet.DataProtection;
|
||||
using Microsoft.AspNet.Html.Abstractions;
|
||||
using Microsoft.AspNet.Http.Internal;
|
||||
using Microsoft.AspNet.Mvc.ModelBinding;
|
||||
using Microsoft.AspNet.Mvc.Rendering;
|
||||
|
|
@ -70,9 +71,9 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
return viewContext;
|
||||
}
|
||||
|
||||
public override HtmlString GenerateAntiforgery(ViewContext viewContext)
|
||||
public override IHtmlContent GenerateAntiforgery(ViewContext viewContext)
|
||||
{
|
||||
var tagBuilder = new TagBuilder("input", new CommonTestEncoder())
|
||||
var tagBuilder = new TagBuilder("input")
|
||||
{
|
||||
Attributes =
|
||||
{
|
||||
|
|
@ -82,7 +83,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
},
|
||||
};
|
||||
|
||||
return tagBuilder.ToHtmlString(TagRenderMode.SelfClosing);
|
||||
return tagBuilder.ToHtmlContent(TagRenderMode.SelfClosing);
|
||||
}
|
||||
|
||||
protected override IDictionary<string, object> GetValidationAttributes(
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ using System.Linq;
|
|||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.Mvc.ModelBinding;
|
||||
using Microsoft.AspNet.Mvc.Rendering;
|
||||
using Microsoft.AspNet.Mvc.TestCommon;
|
||||
using Microsoft.AspNet.Razor.Runtime.TagHelpers;
|
||||
using Xunit;
|
||||
|
||||
|
|
@ -46,32 +47,32 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
{
|
||||
{ null, typeof(Model), null,
|
||||
new NameAndId("Text", "Text"),
|
||||
Environment.NewLine + "HtmlEncode[[]]" },
|
||||
Environment.NewLine },
|
||||
|
||||
{ modelWithNull, typeof(Model), modelWithNull.Text,
|
||||
new NameAndId("Text", "Text"),
|
||||
Environment.NewLine + "HtmlEncode[[]]" },
|
||||
Environment.NewLine },
|
||||
{ modelWithText, typeof(Model), modelWithText.Text,
|
||||
new NameAndId("Text", "Text"),
|
||||
Environment.NewLine + "HtmlEncode[[outer text]]" },
|
||||
|
||||
{ modelWithNull, typeof(NestedModel), modelWithNull.NestedModel.Text,
|
||||
new NameAndId("NestedModel.Text", "NestedModel_Text"),
|
||||
Environment.NewLine + "HtmlEncode[[]]" },
|
||||
Environment.NewLine },
|
||||
{ modelWithText, typeof(NestedModel), modelWithText.NestedModel.Text,
|
||||
new NameAndId("NestedModel.Text", "NestedModel_Text"),
|
||||
Environment.NewLine + "HtmlEncode[[inner text]]" },
|
||||
|
||||
{ models, typeof(Model), models[0].Text,
|
||||
new NameAndId("[0].Text", "z0__Text"),
|
||||
Environment.NewLine + "HtmlEncode[[]]" },
|
||||
Environment.NewLine },
|
||||
{ models, typeof(Model), models[1].Text,
|
||||
new NameAndId("[1].Text", "z1__Text"),
|
||||
Environment.NewLine + "HtmlEncode[[outer text]]" },
|
||||
|
||||
{ models, typeof(NestedModel), models[0].NestedModel.Text,
|
||||
new NameAndId("[0].NestedModel.Text", "z0__NestedModel_Text"),
|
||||
Environment.NewLine + "HtmlEncode[[]]" },
|
||||
Environment.NewLine },
|
||||
{ models, typeof(NestedModel), models[1].NestedModel.Text,
|
||||
new NameAndId("[1].NestedModel.Text", "z1__NestedModel_Text"),
|
||||
Environment.NewLine + "HtmlEncode[[inner text]]" },
|
||||
|
|
@ -151,7 +152,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
// Assert
|
||||
Assert.True(output.SelfClosing);
|
||||
Assert.Equal(expectedAttributes, output.Attributes);
|
||||
Assert.Equal(expectedContent, output.Content.GetContent());
|
||||
Assert.Equal(expectedContent, HtmlContentUtilities.HtmlContentToString(output.Content));
|
||||
Assert.Equal(expectedTagName, output.TagName);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
generator
|
||||
.Setup(mock =>
|
||||
mock.GenerateValidationMessage(expectedViewContext, "Hello", null, null, null))
|
||||
.Returns(new TagBuilder("span", new CommonTestEncoder()))
|
||||
.Returns(new TagBuilder("span"))
|
||||
.Verifiable();
|
||||
|
||||
var validationMessageTagHelper = new ValidationMessageTagHelper(generator.Object)
|
||||
|
|
@ -142,9 +142,9 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
string childContent, string outputContent, string expectedOutputContent)
|
||||
{
|
||||
// Arrange
|
||||
var tagBuilder = new TagBuilder("span2", new CommonTestEncoder())
|
||||
var tagBuilder = new TagBuilder("span2")
|
||||
{
|
||||
InnerHtml = "New HTML"
|
||||
InnerHtml = new HtmlString("New HTML")
|
||||
};
|
||||
tagBuilder.Attributes.Add("data-foo", "bar");
|
||||
tagBuilder.Attributes.Add("data-hello", "world");
|
||||
|
|
@ -203,9 +203,9 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
string childContent, string expectedOutputContent)
|
||||
{
|
||||
// Arrange
|
||||
var tagBuilder = new TagBuilder("span2", new CommonTestEncoder())
|
||||
var tagBuilder = new TagBuilder("span2")
|
||||
{
|
||||
InnerHtml = "New HTML"
|
||||
InnerHtml = new HtmlString("New HTML")
|
||||
};
|
||||
tagBuilder.Attributes.Add("data-foo", "bar");
|
||||
tagBuilder.Attributes.Add("data-hello", "world");
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
null, // message
|
||||
null, // headerTag
|
||||
null)) // htmlAttributes
|
||||
.Returns(new TagBuilder("div", new HtmlEncoder()))
|
||||
.Returns(new TagBuilder("div"))
|
||||
.Verifiable();
|
||||
|
||||
var validationSummaryTagHelper = new ValidationSummaryTagHelper(generator.Object)
|
||||
|
|
@ -130,9 +130,9 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
public async Task ProcessAsync_MergesTagBuilderFromGenerateValidationSummary()
|
||||
{
|
||||
// Arrange
|
||||
var tagBuilder = new TagBuilder("span2", new HtmlEncoder())
|
||||
var tagBuilder = new TagBuilder("span2")
|
||||
{
|
||||
InnerHtml = "New HTML"
|
||||
InnerHtml = new HtmlString("New HTML")
|
||||
};
|
||||
|
||||
tagBuilder.Attributes.Add("data-foo", "bar");
|
||||
|
|
@ -224,9 +224,9 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
|
|||
public async Task ProcessAsync_GeneratesValidationSummaryWhenNotNone(ValidationSummary validationSummary)
|
||||
{
|
||||
// Arrange
|
||||
var tagBuilder = new TagBuilder("span2", new HtmlEncoder())
|
||||
var tagBuilder = new TagBuilder("span2")
|
||||
{
|
||||
InnerHtml = "New HTML"
|
||||
InnerHtml = new HtmlString("New HTML")
|
||||
};
|
||||
|
||||
var generator = new Mock<IHtmlGenerator>();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,27 @@
|
|||
// 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 System.IO;
|
||||
using Microsoft.AspNet.Html.Abstractions;
|
||||
using Microsoft.Framework.WebEncoders;
|
||||
using Microsoft.Framework.WebEncoders.Testing;
|
||||
|
||||
namespace Microsoft.AspNet.Mvc.TestCommon
|
||||
{
|
||||
public class HtmlContentUtilities
|
||||
{
|
||||
public static string HtmlContentToString(IHtmlContent content, IHtmlEncoder encoder = null)
|
||||
{
|
||||
if (encoder == null)
|
||||
{
|
||||
encoder = new CommonTestEncoder();
|
||||
}
|
||||
|
||||
using (var writer = new StringWriter())
|
||||
{
|
||||
content.WriteTo(writer, encoder);
|
||||
return writer.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,127 +0,0 @@
|
|||
// 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 System.IO;
|
||||
using Microsoft.AspNet.Html.Abstractions;
|
||||
using Microsoft.Framework.WebEncoders;
|
||||
using Microsoft.Framework.WebEncoders.Testing;
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.AspNet.Mvc.Rendering
|
||||
{
|
||||
public class BufferedHtmlContentTest
|
||||
{
|
||||
[Fact]
|
||||
public void AppendString_AppendsAString()
|
||||
{
|
||||
// Arrange
|
||||
var content = new BufferedHtmlContent();
|
||||
|
||||
// Act
|
||||
content.Append("Hello");
|
||||
|
||||
// Assert
|
||||
var result = Assert.Single(content.Entries);
|
||||
Assert.IsType(typeof(string), result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AppendCharArray_AppendsAsString()
|
||||
{
|
||||
// Arrange
|
||||
var content = new BufferedHtmlContent();
|
||||
|
||||
// Act
|
||||
content.Append(new char[] { 'h', 'e', 'l', 'l', 'o' }, 0, 5);
|
||||
|
||||
// Assert
|
||||
var result = Assert.Single(content.Entries);
|
||||
Assert.IsType(typeof(string), result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AppendIHtmlContent_AppendsAsIs()
|
||||
{
|
||||
// Arrange
|
||||
var content = new BufferedHtmlContent();
|
||||
var writer = new StringWriter();
|
||||
|
||||
// Act
|
||||
content.Append(new TestHtmlContent("Hello"));
|
||||
|
||||
// Assert
|
||||
var result = Assert.Single(content.Entries);
|
||||
var testHtmlContent = Assert.IsType<TestHtmlContent>(result);
|
||||
testHtmlContent.WriteTo(writer, new CommonTestEncoder());
|
||||
Assert.Equal("Written from TestHtmlContent: Hello", writer.ToString());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CanAppendMultipleItems()
|
||||
{
|
||||
// Arrange
|
||||
var content = new BufferedHtmlContent();
|
||||
|
||||
// Act
|
||||
content.Append(new TestHtmlContent("hello"));
|
||||
content.Append("Test");
|
||||
|
||||
// Assert
|
||||
Assert.Equal(2, content.Entries.Count);
|
||||
Assert.Equal("Written from TestHtmlContent: hello", content.Entries[0].ToString());
|
||||
Assert.Equal("Test", content.Entries[1]);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Clear_DeletesAllItems()
|
||||
{
|
||||
// Arrange
|
||||
var content = new BufferedHtmlContent();
|
||||
content.Append(new TestHtmlContent("hello"));
|
||||
content.Append("Test");
|
||||
|
||||
// Act
|
||||
content.Clear();
|
||||
|
||||
// Assert
|
||||
Assert.Equal(0, content.Entries.Count);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void WriteTo_WritesAllItems()
|
||||
{
|
||||
// Arrange
|
||||
var content = new BufferedHtmlContent();
|
||||
var writer = new StringWriter();
|
||||
content.Append(new TestHtmlContent("Hello"));
|
||||
content.Append("Test");
|
||||
|
||||
// Act
|
||||
content.WriteTo(writer, new CommonTestEncoder());
|
||||
|
||||
// Assert
|
||||
Assert.Equal(2, content.Entries.Count);
|
||||
Assert.Equal("Written from TestHtmlContent: HelloTest", writer.ToString());
|
||||
}
|
||||
|
||||
private class TestHtmlContent : IHtmlContent
|
||||
{
|
||||
private string _content;
|
||||
|
||||
public TestHtmlContent(string content)
|
||||
{
|
||||
_content = content;
|
||||
}
|
||||
|
||||
public void WriteTo(TextWriter writer, IHtmlEncoder encoder)
|
||||
{
|
||||
writer.Write(ToString());
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return "Written from TestHtmlContent: " + _content;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -10,6 +10,7 @@ using System.Text;
|
|||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.Mvc.ModelBinding;
|
||||
using Microsoft.AspNet.Mvc.Rendering;
|
||||
using Microsoft.AspNet.Mvc.TestCommon;
|
||||
using Moq;
|
||||
using Xunit;
|
||||
|
||||
|
|
@ -63,7 +64,7 @@ namespace Microsoft.AspNet.Mvc.Core
|
|||
var result = DefaultDisplayTemplates.ObjectTemplate(html);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result);
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -82,7 +83,7 @@ namespace Microsoft.AspNet.Mvc.Core
|
|||
var result = DefaultDisplayTemplates.ObjectTemplate(html);
|
||||
|
||||
// Assert
|
||||
Assert.Equal("(null value)", result);
|
||||
Assert.Equal("(null value)", HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
|
|
@ -112,7 +113,7 @@ namespace Microsoft.AspNet.Mvc.Core
|
|||
var result = DefaultDisplayTemplates.ObjectTemplate(html);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedResult, result);
|
||||
Assert.Equal(expectedResult, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -121,9 +122,9 @@ namespace Microsoft.AspNet.Mvc.Core
|
|||
// Arrange
|
||||
var expected =
|
||||
@"<div class=""HtmlEncode[[display-label]]"">HtmlEncode[[Property1]]</div>
|
||||
<div class=""HtmlEncode[[display-field]]"">HtmlEncode[[]]</div>
|
||||
<div class=""HtmlEncode[[display-field]]""></div>
|
||||
<div class=""HtmlEncode[[display-label]]"">HtmlEncode[[Property3]]</div>
|
||||
<div class=""HtmlEncode[[display-field]]"">HtmlEncode[[]]</div>
|
||||
<div class=""HtmlEncode[[display-field]]""></div>
|
||||
";
|
||||
var model = new DefaultTemplatesUtilities.ObjectWithScaffoldColumn();
|
||||
var viewEngine = new Mock<ICompositeViewEngine>();
|
||||
|
|
@ -135,7 +136,7 @@ namespace Microsoft.AspNet.Mvc.Core
|
|||
var result = DefaultDisplayTemplates.ObjectTemplate(htmlHelper);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result);
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -162,7 +163,7 @@ namespace Microsoft.AspNet.Mvc.Core
|
|||
var result = DefaultDisplayTemplates.ObjectTemplate(html);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result);
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -204,7 +205,7 @@ namespace Microsoft.AspNet.Mvc.Core
|
|||
var result = DefaultDisplayTemplates.ObjectTemplate(html);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result);
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -223,7 +224,7 @@ namespace Microsoft.AspNet.Mvc.Core
|
|||
var result = DefaultDisplayTemplates.HiddenInputTemplate(html);
|
||||
|
||||
// Assert
|
||||
Assert.Equal("HtmlEncode[[Formatted string]]", result);
|
||||
Assert.Equal("HtmlEncode[[Formatted string]]", HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -249,7 +250,7 @@ namespace Microsoft.AspNet.Mvc.Core
|
|||
var result = DefaultDisplayTemplates.HiddenInputTemplate(html);
|
||||
|
||||
// Assert
|
||||
Assert.Empty(result);
|
||||
Assert.Empty(HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -268,7 +269,7 @@ namespace Microsoft.AspNet.Mvc.Core
|
|||
var result = helper.Display("Property1");
|
||||
|
||||
// Assert
|
||||
Assert.Equal("HtmlEncode[[ViewData string]]", result.ToString());
|
||||
Assert.Equal("HtmlEncode[[ViewData string]]", HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -287,7 +288,7 @@ namespace Microsoft.AspNet.Mvc.Core
|
|||
var result = helper.DisplayFor(m => m.Property1);
|
||||
|
||||
// Assert
|
||||
Assert.Equal("HtmlEncode[[Model string]]", result.ToString());
|
||||
Assert.Equal("HtmlEncode[[Model string]]", HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -305,7 +306,7 @@ namespace Microsoft.AspNet.Mvc.Core
|
|||
var result = helper.Display("Property1");
|
||||
|
||||
// Assert
|
||||
Assert.Equal("HtmlEncode[[Model string]]", result.ToString());
|
||||
Assert.Equal("HtmlEncode[[Model string]]", HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
|
|
@ -326,7 +327,7 @@ namespace Microsoft.AspNet.Mvc.Core
|
|||
var result = helper.DisplayFor(m => m.Property1);
|
||||
|
||||
// Assert
|
||||
Assert.Equal("HtmlEncode[[]]", result.ToString());
|
||||
Assert.Equal(string.Empty, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ using Microsoft.AspNet.Mvc.ModelBinding;
|
|||
using Microsoft.AspNet.Mvc.ModelBinding.Validation;
|
||||
using Microsoft.AspNet.Mvc.Rendering;
|
||||
using Microsoft.AspNet.Mvc.Rendering.Internal;
|
||||
using Microsoft.AspNet.Mvc.TestCommon;
|
||||
using Microsoft.AspNet.Testing;
|
||||
using Microsoft.Framework.Internal;
|
||||
using Microsoft.Framework.WebEncoders;
|
||||
|
|
@ -111,7 +112,7 @@ namespace Microsoft.AspNet.Mvc.Core
|
|||
var result = DefaultEditorTemplates.ObjectTemplate(html);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result);
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -134,7 +135,7 @@ namespace Microsoft.AspNet.Mvc.Core
|
|||
var result = DefaultEditorTemplates.ObjectTemplate(html);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(html.ViewData.ModelMetadata.NullDisplayText, result);
|
||||
Assert.Equal(html.ViewData.ModelMetadata.NullDisplayText, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
|
|
@ -167,7 +168,7 @@ namespace Microsoft.AspNet.Mvc.Core
|
|||
var result = DefaultEditorTemplates.ObjectTemplate(html);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedResult, result);
|
||||
Assert.Equal(expectedResult, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -196,7 +197,7 @@ Environment.NewLine;
|
|||
var result = DefaultEditorTemplates.ObjectTemplate(htmlHelper);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result);
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -226,7 +227,7 @@ Environment.NewLine;
|
|||
var result = DefaultEditorTemplates.ObjectTemplate(html);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result);
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -270,7 +271,7 @@ Environment.NewLine;
|
|||
var result = DefaultEditorTemplates.ObjectTemplate(html);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result);
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -292,7 +293,7 @@ Environment.NewLine;
|
|||
var result = DefaultEditorTemplates.HiddenInputTemplate(html);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result);
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -319,7 +320,7 @@ Environment.NewLine;
|
|||
var result = DefaultEditorTemplates.HiddenInputTemplate(html);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result);
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -343,7 +344,7 @@ Environment.NewLine;
|
|||
var result = DefaultEditorTemplates.MultilineTemplate(html);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result);
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
|
|
@ -373,7 +374,7 @@ Environment.NewLine;
|
|||
additionalViewData: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedResult, result.ToString());
|
||||
Assert.Equal(expectedResult, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
|
|
@ -402,7 +403,7 @@ Environment.NewLine;
|
|||
additionalViewData: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedResult, result.ToString());
|
||||
Assert.Equal(expectedResult, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
|
|
@ -441,7 +442,7 @@ Environment.NewLine;
|
|||
additionalViewData: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedResult, result.ToString());
|
||||
Assert.Equal(expectedResult, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
|
|
@ -479,7 +480,7 @@ Environment.NewLine;
|
|||
additionalViewData: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedResult, result.ToString());
|
||||
Assert.Equal(expectedResult, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
|
|
@ -518,7 +519,7 @@ Environment.NewLine;
|
|||
additionalViewData: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedResult, result.ToString());
|
||||
Assert.Equal(expectedResult, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
|
|
@ -556,7 +557,7 @@ Environment.NewLine;
|
|||
additionalViewData: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedResult, result.ToString());
|
||||
Assert.Equal(expectedResult, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -577,7 +578,7 @@ Environment.NewLine;
|
|||
// Assert
|
||||
Assert.Equal(
|
||||
"<input class=\"HtmlEncode[[text-box single-line]]\" id=\"HtmlEncode[[Property1]]\" name=\"HtmlEncode[[Property1]]\" type=\"HtmlEncode[[text]]\" value=\"HtmlEncode[[ViewData string]]\" />",
|
||||
result.ToString());
|
||||
HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
// DateTime-local is not special-cased unless using Html5DateRenderingMode.Rfc3339.
|
||||
|
|
@ -631,7 +632,7 @@ Environment.NewLine;
|
|||
var result = helper.Editor("");
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedInput, result.ToString());
|
||||
Assert.Equal(expectedInput, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
|
|
@ -686,7 +687,7 @@ Environment.NewLine;
|
|||
var result = helper.Editor("");
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedInput, result.ToString());
|
||||
Assert.Equal(expectedInput, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
|
|
@ -746,7 +747,7 @@ Environment.NewLine;
|
|||
var result = helper.Editor("");
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedInput, result.ToString());
|
||||
Assert.Equal(expectedInput, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -767,7 +768,7 @@ Environment.NewLine;
|
|||
// Assert
|
||||
Assert.Equal(
|
||||
"<input class=\"HtmlEncode[[text-box single-line]]\" id=\"HtmlEncode[[Property1]]\" name=\"HtmlEncode[[Property1]]\" type=\"HtmlEncode[[text]]\" value=\"HtmlEncode[[Model string]]\" />",
|
||||
result.ToString());
|
||||
HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -787,7 +788,7 @@ Environment.NewLine;
|
|||
// Assert
|
||||
Assert.Equal(
|
||||
"<input class=\"HtmlEncode[[text-box single-line]]\" id=\"HtmlEncode[[Property1]]\" name=\"HtmlEncode[[Property1]]\" type=\"HtmlEncode[[text]]\" value=\"HtmlEncode[[Model string]]\" />",
|
||||
result.ToString());
|
||||
HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
|
|
@ -810,7 +811,7 @@ Environment.NewLine;
|
|||
// Assert
|
||||
Assert.Equal(
|
||||
"<input class=\"HtmlEncode[[text-box single-line]]\" id=\"HtmlEncode[[Property1]]\" name=\"HtmlEncode[[Property1]]\" type=\"HtmlEncode[[text]]\" value=\"\" />",
|
||||
result.ToString());
|
||||
HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -917,11 +918,6 @@ Environment.NewLine;
|
|||
get { return _innerHelper.TempData; }
|
||||
}
|
||||
|
||||
public IHtmlEncoder HtmlEncoder
|
||||
{
|
||||
get { return _innerHelper.HtmlEncoder; }
|
||||
}
|
||||
|
||||
public IUrlEncoder UrlEncoder
|
||||
{
|
||||
get { return _innerHelper.UrlEncoder; }
|
||||
|
|
@ -937,7 +933,7 @@ Environment.NewLine;
|
|||
(_innerHelper as ICanHasViewContext)?.Contextualize(viewContext);
|
||||
}
|
||||
|
||||
public HtmlString ActionLink(
|
||||
public IHtmlContent ActionLink(
|
||||
[NotNull] string linkText,
|
||||
string actionName,
|
||||
string controllerName,
|
||||
|
|
@ -950,7 +946,7 @@ Environment.NewLine;
|
|||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public HtmlString AntiForgeryToken()
|
||||
public IHtmlContent AntiForgeryToken()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
|
@ -974,12 +970,12 @@ Environment.NewLine;
|
|||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public HtmlString CheckBox(string name, bool? isChecked, object htmlAttributes)
|
||||
public IHtmlContent CheckBox(string name, bool? isChecked, object htmlAttributes)
|
||||
{
|
||||
return HelperName("__CheckBox__", htmlAttributes);
|
||||
}
|
||||
|
||||
public HtmlString Display(
|
||||
public IHtmlContent Display(
|
||||
string expression,
|
||||
string templateName,
|
||||
string htmlFieldName,
|
||||
|
|
@ -998,7 +994,7 @@ Environment.NewLine;
|
|||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public HtmlString DropDownList(
|
||||
public IHtmlContent DropDownList(
|
||||
string name,
|
||||
IEnumerable<SelectListItem> selectList,
|
||||
string optionLabel,
|
||||
|
|
@ -1007,7 +1003,7 @@ Environment.NewLine;
|
|||
return HelperName("__DropDownList__", htmlAttributes);
|
||||
}
|
||||
|
||||
public HtmlString Editor(
|
||||
public IHtmlContent Editor(
|
||||
string expression,
|
||||
string templateName,
|
||||
string htmlFieldName,
|
||||
|
|
@ -1058,7 +1054,7 @@ Environment.NewLine;
|
|||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public HtmlString Hidden(string name, object value, object htmlAttributes)
|
||||
public IHtmlContent Hidden(string name, object value, object htmlAttributes)
|
||||
{
|
||||
return HelperName("__Hidden__", htmlAttributes);
|
||||
}
|
||||
|
|
@ -1068,12 +1064,12 @@ Environment.NewLine;
|
|||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public HtmlString Label(string expression, string labelText, object htmlAttributes)
|
||||
public IHtmlContent Label(string expression, string labelText, object htmlAttributes)
|
||||
{
|
||||
return HelperName("__Label__", htmlAttributes);
|
||||
}
|
||||
|
||||
public HtmlString ListBox(string name, IEnumerable<SelectListItem> selectList, object htmlAttributes)
|
||||
public IHtmlContent ListBox(string name, IEnumerable<SelectListItem> selectList, object htmlAttributes)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
|
@ -1091,22 +1087,22 @@ Environment.NewLine;
|
|||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public HtmlString Password(string name, object value, object htmlAttributes)
|
||||
public IHtmlContent Password(string name, object value, object htmlAttributes)
|
||||
{
|
||||
return HelperName("__Password__", htmlAttributes);
|
||||
}
|
||||
|
||||
public HtmlString RadioButton(string name, object value, bool? isChecked, object htmlAttributes)
|
||||
public IHtmlContent RadioButton(string name, object value, bool? isChecked, object htmlAttributes)
|
||||
{
|
||||
return HelperName("__RadioButton__", htmlAttributes);
|
||||
}
|
||||
|
||||
public HtmlString Raw(object value)
|
||||
public IHtmlContent Raw(object value)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public HtmlString Raw(string value)
|
||||
public IHtmlContent Raw(string value)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
|
@ -1116,7 +1112,7 @@ Environment.NewLine;
|
|||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public HtmlString RouteLink(
|
||||
public IHtmlContent RouteLink(
|
||||
[NotNull] string linkText,
|
||||
string routeName,
|
||||
string protocol,
|
||||
|
|
@ -1128,22 +1124,22 @@ Environment.NewLine;
|
|||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public HtmlString TextArea(string name, string value, int rows, int columns, object htmlAttributes)
|
||||
public IHtmlContent TextArea(string name, string value, int rows, int columns, object htmlAttributes)
|
||||
{
|
||||
return HelperName("__TextArea__", htmlAttributes);
|
||||
}
|
||||
|
||||
public HtmlString TextBox(string name, object value, string format, object htmlAttributes)
|
||||
public IHtmlContent TextBox(string name, object value, string format, object htmlAttributes)
|
||||
{
|
||||
return HelperName("__TextBox__", htmlAttributes);
|
||||
}
|
||||
|
||||
public HtmlString ValidationMessage(string modelName, string message, object htmlAttributes, string tag)
|
||||
public IHtmlContent ValidationMessage(string modelName, string message, object htmlAttributes, string tag)
|
||||
{
|
||||
return HelperName("__ValidationMessage__", htmlAttributes);
|
||||
}
|
||||
|
||||
public HtmlString ValidationSummary(
|
||||
public IHtmlContent ValidationSummary(
|
||||
bool excludePropertyErrors,
|
||||
string message,
|
||||
object htmlAttributes,
|
||||
|
|
@ -1157,7 +1153,7 @@ Environment.NewLine;
|
|||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private HtmlString HelperName(string name, object htmlAttributes)
|
||||
private IHtmlContent HelperName(string name, object htmlAttributes)
|
||||
{
|
||||
var htmlAttributesDictionary = HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes);
|
||||
var htmlAttributesString =
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ using System.Collections.Generic;
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Globalization;
|
||||
using Microsoft.AspNet.Mvc.ModelBinding;
|
||||
using Microsoft.AspNet.Mvc.TestCommon;
|
||||
using Microsoft.AspNet.Routing;
|
||||
using Xunit;
|
||||
|
||||
|
|
@ -31,7 +32,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
htmlAttributes: new { @checked = "checked", value = "false" });
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, html.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(html));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -53,7 +54,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
htmlAttributes: new { @checked = "unchecked", value = "false" });
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, html.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(html));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -70,7 +71,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
htmlAttributes: new { @checked = "unchecked", value = "false" });
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, html.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(html));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -121,7 +122,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.CheckBox("Property1", isChecked: true, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, html.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(html));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -141,7 +142,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.CheckBox("Property1", isChecked: null, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, html.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(html));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -160,7 +161,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.CheckBox("Property1", isChecked: null, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, html.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(html));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -182,7 +183,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.CheckBox("Property1", isChecked: null, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, html.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(html));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -203,7 +204,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.CheckBox("Prefix.Property1", isChecked: null, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, html.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(html));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -225,7 +226,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.CheckBox("Property1", isChecked: null, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, html.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(html));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -245,7 +246,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.CheckBox("Property1", isChecked: null, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, html.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(html));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -266,7 +267,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.CheckBox("Property1", isChecked: null, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, html.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(html));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -285,7 +286,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.CheckBox("Property1", isChecked: null, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, html.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(html));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -305,7 +306,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.CheckBox("Property1", isChecked: null, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, html.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(html));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -323,7 +324,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.CheckBox("Name", isChecked: null, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, html.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(html));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -344,7 +345,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.CheckBox("Property1", isChecked: true, htmlAttributes: htmlAttributes);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, html.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(html));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -362,7 +363,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.CheckBox("Property1", isChecked: false, htmlAttributes: dictionary);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, html.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(html));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -382,7 +383,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.CheckBox("Property1", isChecked: false, htmlAttributes: dictionary);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, html.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(html));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -403,7 +404,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.CheckBox(string.Empty, isChecked: false, htmlAttributes: attributes);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, html.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(html));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -423,7 +424,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.CheckBox("ComplexProperty.Property1", isChecked: null, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, html.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(html));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -444,7 +445,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.CheckBoxFor(m => m.Property1, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, html.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(html));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
|
|
@ -472,7 +473,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.CheckBoxFor(m => m.Property1, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, html.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(html));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -491,7 +492,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.CheckBoxFor(m => m.Property3, new { @checked = "checked", value = "false" });
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, html.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(html));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -514,7 +515,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.CheckBoxFor(m => m.Name, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, html.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(html));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
|
|
@ -540,7 +541,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.CheckBoxFor(m => m.Property1, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, html.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(html));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -560,7 +561,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.CheckBoxFor(m => m.Property1, htmlAttributes);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, html.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(html));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -580,7 +581,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.CheckBoxFor(m => m.Property1, attributes);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, html.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(html));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -601,7 +602,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.CheckBoxFor(m => m.Property1, attributes);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, html.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(html));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -620,7 +621,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.CheckBoxFor(m => m.ComplexProperty.Property1, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, html.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(html));
|
||||
}
|
||||
|
||||
private static ViewDataDictionary<TestModel> GetTestModelViewData()
|
||||
|
|
|
|||
|
|
@ -276,7 +276,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
public void BeginFormWithNoParameters_CallsHtmlGeneratorWithExpectedValues()
|
||||
{
|
||||
// Arrange
|
||||
var tagBuilder = new TagBuilder(tagName: "form", htmlEncoder: new NullTestEncoder());
|
||||
var tagBuilder = new TagBuilder(tagName: "form");
|
||||
var htmlGenerator = new Mock<IHtmlGenerator>(MockBehavior.Strict);
|
||||
var htmlHelper = DefaultTemplatesUtilities.GetHtmlHelper(htmlGenerator.Object);
|
||||
htmlGenerator
|
||||
|
|
@ -310,7 +310,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
public void BeginFormWithMethodParameter_CallsHtmlGeneratorWithExpectedValues(FormMethod method)
|
||||
{
|
||||
// Arrange
|
||||
var tagBuilder = new TagBuilder(tagName: "form", htmlEncoder: new NullTestEncoder());
|
||||
var tagBuilder = new TagBuilder(tagName: "form");
|
||||
var htmlGenerator = new Mock<IHtmlGenerator>(MockBehavior.Strict);
|
||||
var htmlHelper = DefaultTemplatesUtilities.GetHtmlHelper(htmlGenerator.Object);
|
||||
htmlGenerator
|
||||
|
|
@ -346,7 +346,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
object htmlAttributes)
|
||||
{
|
||||
// Arrange
|
||||
var tagBuilder = new TagBuilder(tagName: "form", htmlEncoder: new NullTestEncoder());
|
||||
var tagBuilder = new TagBuilder(tagName: "form");
|
||||
var htmlGenerator = new Mock<IHtmlGenerator>(MockBehavior.Strict);
|
||||
var htmlHelper = DefaultTemplatesUtilities.GetHtmlHelper(htmlGenerator.Object);
|
||||
htmlGenerator
|
||||
|
|
@ -380,7 +380,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
public void BeginFormWithRouteValuesParameter_CallsHtmlGeneratorWithExpectedValues(object routeValues)
|
||||
{
|
||||
// Arrange
|
||||
var tagBuilder = new TagBuilder(tagName: "form", htmlEncoder: new NullTestEncoder());
|
||||
var tagBuilder = new TagBuilder(tagName: "form");
|
||||
var htmlGenerator = new Mock<IHtmlGenerator>(MockBehavior.Strict);
|
||||
var htmlHelper = DefaultTemplatesUtilities.GetHtmlHelper(htmlGenerator.Object);
|
||||
htmlGenerator
|
||||
|
|
@ -416,7 +416,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
string controllerName)
|
||||
{
|
||||
// Arrange
|
||||
var tagBuilder = new TagBuilder(tagName: "form", htmlEncoder: new NullTestEncoder());
|
||||
var tagBuilder = new TagBuilder(tagName: "form");
|
||||
var htmlGenerator = new Mock<IHtmlGenerator>(MockBehavior.Strict);
|
||||
var htmlHelper = DefaultTemplatesUtilities.GetHtmlHelper(htmlGenerator.Object);
|
||||
htmlGenerator
|
||||
|
|
@ -453,7 +453,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
object routeValues)
|
||||
{
|
||||
// Arrange
|
||||
var tagBuilder = new TagBuilder(tagName: "form", htmlEncoder: new NullTestEncoder());
|
||||
var tagBuilder = new TagBuilder(tagName: "form");
|
||||
var htmlGenerator = new Mock<IHtmlGenerator>(MockBehavior.Strict);
|
||||
var htmlHelper = DefaultTemplatesUtilities.GetHtmlHelper(htmlGenerator.Object);
|
||||
htmlGenerator
|
||||
|
|
@ -490,7 +490,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
FormMethod method)
|
||||
{
|
||||
// Arrange
|
||||
var tagBuilder = new TagBuilder(tagName: "form", htmlEncoder: new NullTestEncoder());
|
||||
var tagBuilder = new TagBuilder(tagName: "form");
|
||||
var htmlGenerator = new Mock<IHtmlGenerator>(MockBehavior.Strict);
|
||||
var htmlHelper = DefaultTemplatesUtilities.GetHtmlHelper(htmlGenerator.Object);
|
||||
htmlGenerator
|
||||
|
|
@ -528,7 +528,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
FormMethod method)
|
||||
{
|
||||
// Arrange
|
||||
var tagBuilder = new TagBuilder(tagName: "form", htmlEncoder: new NullTestEncoder());
|
||||
var tagBuilder = new TagBuilder(tagName: "form");
|
||||
var htmlGenerator = new Mock<IHtmlGenerator>(MockBehavior.Strict);
|
||||
var htmlHelper = DefaultTemplatesUtilities.GetHtmlHelper(htmlGenerator.Object);
|
||||
htmlGenerator
|
||||
|
|
@ -566,7 +566,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
object htmlAttributes)
|
||||
{
|
||||
// Arrange
|
||||
var tagBuilder = new TagBuilder(tagName: "form", htmlEncoder: new NullTestEncoder());
|
||||
var tagBuilder = new TagBuilder(tagName: "form");
|
||||
var htmlGenerator = new Mock<IHtmlGenerator>(MockBehavior.Strict);
|
||||
var htmlHelper = DefaultTemplatesUtilities.GetHtmlHelper(htmlGenerator.Object);
|
||||
htmlGenerator
|
||||
|
|
@ -600,7 +600,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
public void BeginRouteFormWithRouteValuesParameter_CallsHtmlGeneratorWithExpectedValues(object routeValues)
|
||||
{
|
||||
// Arrange
|
||||
var tagBuilder = new TagBuilder(tagName: "form", htmlEncoder: new NullTestEncoder());
|
||||
var tagBuilder = new TagBuilder(tagName: "form");
|
||||
var htmlGenerator = new Mock<IHtmlGenerator>(MockBehavior.Strict);
|
||||
var htmlHelper = DefaultTemplatesUtilities.GetHtmlHelper(htmlGenerator.Object);
|
||||
htmlGenerator
|
||||
|
|
@ -633,7 +633,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
public void BeginRouteFormWithRouteNameParameter_CallsHtmlGeneratorWithExpectedValues(string routeName)
|
||||
{
|
||||
// Arrange
|
||||
var tagBuilder = new TagBuilder(tagName: "form", htmlEncoder: new NullTestEncoder());
|
||||
var tagBuilder = new TagBuilder(tagName: "form");
|
||||
var htmlGenerator = new Mock<IHtmlGenerator>(MockBehavior.Strict);
|
||||
var htmlHelper = DefaultTemplatesUtilities.GetHtmlHelper(htmlGenerator.Object);
|
||||
htmlGenerator
|
||||
|
|
@ -668,7 +668,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
object routeValues)
|
||||
{
|
||||
// Arrange
|
||||
var tagBuilder = new TagBuilder(tagName: "form", htmlEncoder: new NullTestEncoder());
|
||||
var tagBuilder = new TagBuilder(tagName: "form");
|
||||
var htmlGenerator = new Mock<IHtmlGenerator>(MockBehavior.Strict);
|
||||
var htmlHelper = DefaultTemplatesUtilities.GetHtmlHelper(htmlGenerator.Object);
|
||||
htmlGenerator
|
||||
|
|
@ -703,7 +703,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
FormMethod method)
|
||||
{
|
||||
// Arrange
|
||||
var tagBuilder = new TagBuilder(tagName: "form", htmlEncoder: new NullTestEncoder());
|
||||
var tagBuilder = new TagBuilder(tagName: "form");
|
||||
var htmlGenerator = new Mock<IHtmlGenerator>(MockBehavior.Strict);
|
||||
var htmlHelper = DefaultTemplatesUtilities.GetHtmlHelper(htmlGenerator.Object);
|
||||
htmlGenerator
|
||||
|
|
@ -739,7 +739,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
FormMethod method)
|
||||
{
|
||||
// Arrange
|
||||
var tagBuilder = new TagBuilder(tagName: "form", htmlEncoder: new NullTestEncoder());
|
||||
var tagBuilder = new TagBuilder(tagName: "form");
|
||||
var htmlGenerator = new Mock<IHtmlGenerator>(MockBehavior.Strict);
|
||||
var htmlHelper = DefaultTemplatesUtilities.GetHtmlHelper(htmlGenerator.Object);
|
||||
htmlGenerator
|
||||
|
|
@ -775,7 +775,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
object htmlAttributes)
|
||||
{
|
||||
// Arrange
|
||||
var tagBuilder = new TagBuilder(tagName: "form", htmlEncoder: new NullTestEncoder());
|
||||
var tagBuilder = new TagBuilder(tagName: "form");
|
||||
var htmlGenerator = new Mock<IHtmlGenerator>(MockBehavior.Strict);
|
||||
var htmlHelper = DefaultTemplatesUtilities.GetHtmlHelper(htmlGenerator.Object);
|
||||
htmlGenerator
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ using System.ComponentModel.DataAnnotations;
|
|||
using System.Globalization;
|
||||
using System.Linq.Expressions;
|
||||
using Microsoft.AspNet.Mvc.ModelBinding;
|
||||
using Microsoft.AspNet.Mvc.TestCommon;
|
||||
using Microsoft.AspNet.Testing;
|
||||
using Xunit;
|
||||
|
||||
|
|
@ -41,7 +42,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var result = helper.Hidden("ProductName", new byte[] { 23, 43, 53 }, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
|
|
@ -56,7 +57,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var result = helper.Hidden("Property1", "test", attributes);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -73,7 +74,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.Hidden("Prefix.Property1", value: null, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, html.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(html));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -91,7 +92,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.Hidden("Property1", value: null, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, html.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(html));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -108,7 +109,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.Hidden("Property1", value: null, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, html.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(html));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -126,7 +127,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.Hidden("Property1", value: null, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, html.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(html));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -142,7 +143,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var result = helper.Hidden("Property1", "explicit-value", attributes);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -158,7 +159,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var result = helper.Hidden("Property1", "test", attributes);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -174,7 +175,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var result = helper.Hidden("Property1", "test", attributes);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -189,7 +190,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var result = helper.Hidden("Property1", value: "explicit-value", htmlAttributes: new { value = "attribute-value" });
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -205,7 +206,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var result = helper.Hidden("Property1", value: "explicit-value", htmlAttributes: new { value = "attribute-value" });
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -221,7 +222,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var result = helper.Hidden("Property1", value: null, htmlAttributes: new { value = "attribute-value" });
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -236,7 +237,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var result = helper.Hidden("Property1", value: null, htmlAttributes: new { value = "attribute-value" });
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -253,7 +254,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.Hidden("Property1", value: null, htmlAttributes: new { value = "attribute-value" });
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, html.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(html));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -267,7 +268,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var result = helper.Hidden("Property1", value: null, htmlAttributes: new { value = "attribute-value" });
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -283,7 +284,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.Hidden("Property1", value: null, htmlAttributes: new { value = "attribute-value" });
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, html.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(html));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -299,7 +300,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var result = helper.Hidden("keyNotFound", value: null, htmlAttributes: attributes);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -315,7 +316,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.Hidden("keyNotFound", value: null, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, html.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(html));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -331,7 +332,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var result = helper.Hidden("Property1", "PropValue", htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -346,7 +347,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var result = helper.Hidden(string.Empty, "fooValue", htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -368,7 +369,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var result = helper.Hidden("Property1", "explicit-value", htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -391,7 +392,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var result = helper.Hidden("Property1", value: null, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -432,7 +433,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var result = helper.Hidden("Property1", value: null, htmlAttributes: attributes);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -449,7 +450,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var result = helper.Hidden("Property2", value: null, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
public static IEnumerable<object[]> HiddenWithComplexExpressions_UsesValueFromViewDataData
|
||||
|
|
@ -495,7 +496,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var result = helper.Hidden(expression, value: null, htmlAttributes: attributes);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
public static IEnumerable<object[]> HiddenWithComplexExpressions_UsesIdDotSeparatorData
|
||||
|
|
@ -534,7 +535,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var result = helper.Hidden(expression, value: null, htmlAttributes: attributes);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -549,7 +550,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var result = helper.HiddenFor(m => m.Bytes, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
|
|
@ -564,7 +565,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var result = helper.HiddenFor(m => m.Property1, htmlAttributes);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -579,7 +580,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var result = helper.HiddenFor(m => m.Property1, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -595,7 +596,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var result = helper.HiddenFor(m => m.Property1, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -611,7 +612,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var result = helper.HiddenFor(m => m.Property1, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -626,7 +627,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var result = helper.HiddenFor(m => m.Property1, attributes);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
// This test ensures that specifying a the prefix does not affect the expression result.
|
||||
|
|
@ -644,7 +645,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var result = helper.HiddenFor(m => m.Property1, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -667,7 +668,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var result = helper.HiddenFor(m => m.Property1, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -687,7 +688,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var result = helper.HiddenFor(m => m.Property1, attributes);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -704,7 +705,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var result = helper.HiddenFor(m => m.Property2, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
public static TheoryData HiddenFor_UsesPropertyValueIfModelStateDoesNotContainValueData
|
||||
|
|
@ -765,7 +766,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var result = helper.HiddenFor(expression, attributes);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
public static TheoryData HiddenFor_UsesModelStateValueForComplexExpressionsData
|
||||
|
|
@ -813,7 +814,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var result = helper.HiddenFor(expression, attributes);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -831,7 +832,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var result = helper.HiddenFor(m => m.Property1, attributes);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
private static ViewDataDictionary<HiddenModel> GetViewDataWithNullModelAndNonNullViewData()
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
using System;
|
||||
using Microsoft.AspNet.Mvc.ModelBinding;
|
||||
using Microsoft.AspNet.Mvc.Rendering;
|
||||
using Microsoft.AspNet.Mvc.TestCommon;
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.AspNet.Mvc.Core
|
||||
|
|
@ -26,10 +27,10 @@ namespace Microsoft.AspNet.Mvc.Core
|
|||
var labelForModelResult = helper.LabelForModel();
|
||||
|
||||
// Assert
|
||||
Assert.Empty(labelResult.ToString());
|
||||
Assert.Empty(labelNullResult.ToString());
|
||||
Assert.Empty(labelForResult.ToString());
|
||||
Assert.Empty(labelForModelResult.ToString());
|
||||
Assert.Empty(HtmlContentUtilities.HtmlContentToString(labelResult));
|
||||
Assert.Empty(HtmlContentUtilities.HtmlContentToString(labelNullResult));
|
||||
Assert.Empty(HtmlContentUtilities.HtmlContentToString(labelForResult));
|
||||
Assert.Empty(HtmlContentUtilities.HtmlContentToString(labelForModelResult));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -43,8 +44,8 @@ namespace Microsoft.AspNet.Mvc.Core
|
|||
var labelForResult = helper.LabelFor(m => m.Property1);
|
||||
|
||||
// Assert
|
||||
Assert.Equal("<label for=\"HtmlEncode[[Property1]]\">HtmlEncode[[Property1]]</label>", labelResult.ToString());
|
||||
Assert.Equal("<label for=\"HtmlEncode[[Property1]]\">HtmlEncode[[Property1]]</label>", labelForResult.ToString());
|
||||
Assert.Equal("<label for=\"HtmlEncode[[Property1]]\">HtmlEncode[[Property1]]</label>", HtmlContentUtilities.HtmlContentToString(labelResult));
|
||||
Assert.Equal("<label for=\"HtmlEncode[[Property1]]\">HtmlEncode[[Property1]]</label>", HtmlContentUtilities.HtmlContentToString(labelForResult));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -58,8 +59,8 @@ namespace Microsoft.AspNet.Mvc.Core
|
|||
var labelForResult = helper.LabelFor(m => m.Inner.Id);
|
||||
|
||||
// Assert
|
||||
Assert.Equal("<label for=\"HtmlEncode[[Inner_Id]]\">HtmlEncode[[Id]]</label>", labelResult.ToString());
|
||||
Assert.Equal("<label for=\"HtmlEncode[[Inner_Id]]\">HtmlEncode[[Id]]</label>", labelForResult.ToString());
|
||||
Assert.Equal("<label for=\"HtmlEncode[[Inner_Id]]\">HtmlEncode[[Id]]</label>", HtmlContentUtilities.HtmlContentToString(labelResult));
|
||||
Assert.Equal("<label for=\"HtmlEncode[[Inner_Id]]\">HtmlEncode[[Id]]</label>", HtmlContentUtilities.HtmlContentToString(labelForResult));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -83,9 +84,9 @@ namespace Microsoft.AspNet.Mvc.Core
|
|||
var labelForModelResult = helper.LabelForModel();
|
||||
|
||||
// Assert
|
||||
Assert.Equal("<label for=\"\">HtmlEncode[[" + propertyName + "]]</label>", labelResult.ToString());
|
||||
Assert.Equal("<label for=\"\">HtmlEncode[[" + propertyName + "]]</label>", labelForResult.ToString());
|
||||
Assert.Equal("<label for=\"\">HtmlEncode[[" + propertyName + "]]</label>", labelForModelResult.ToString());
|
||||
Assert.Equal("<label for=\"\">HtmlEncode[[" + propertyName + "]]</label>", HtmlContentUtilities.HtmlContentToString(labelResult));
|
||||
Assert.Equal("<label for=\"\">HtmlEncode[[" + propertyName + "]]</label>", HtmlContentUtilities.HtmlContentToString(labelForResult));
|
||||
Assert.Equal("<label for=\"\">HtmlEncode[[" + propertyName + "]]</label>", HtmlContentUtilities.HtmlContentToString(labelForModelResult));
|
||||
}
|
||||
|
||||
// If the metadata is for a type (not property), then Label(expression) will evaluate the expression
|
||||
|
|
@ -100,7 +101,7 @@ namespace Microsoft.AspNet.Mvc.Core
|
|||
var labelResult = helper.Label(expression: "value");
|
||||
|
||||
// Assert
|
||||
Assert.Equal("<label for=\"HtmlEncode[[value]]\">HtmlEncode[[value]]</label>", labelResult.ToString());
|
||||
Assert.Equal("<label for=\"HtmlEncode[[value]]\">HtmlEncode[[value]]</label>", HtmlContentUtilities.HtmlContentToString(labelResult));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -121,10 +122,10 @@ namespace Microsoft.AspNet.Mvc.Core
|
|||
var labelForModelResult = helper.LabelForModel();
|
||||
|
||||
// Assert
|
||||
Assert.Empty(labelResult.ToString());
|
||||
Assert.Empty(labelNullResult.ToString());
|
||||
Assert.Empty(labelForResult.ToString());
|
||||
Assert.Empty(labelForModelResult.ToString());
|
||||
Assert.Empty(HtmlContentUtilities.HtmlContentToString(labelResult));
|
||||
Assert.Empty(HtmlContentUtilities.HtmlContentToString(labelNullResult));
|
||||
Assert.Empty(HtmlContentUtilities.HtmlContentToString(labelForResult));
|
||||
Assert.Empty(HtmlContentUtilities.HtmlContentToString(labelForModelResult));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
|
|
@ -146,9 +147,9 @@ namespace Microsoft.AspNet.Mvc.Core
|
|||
var labelForModelResult = helper.LabelForModel();
|
||||
|
||||
// Assert
|
||||
Assert.Equal("<label for=\"\">HtmlEncode[[" + displayName + "]]</label>", labelResult.ToString());
|
||||
Assert.Equal("<label for=\"\">HtmlEncode[[" + displayName + "]]</label>", labelForResult.ToString());
|
||||
Assert.Equal("<label for=\"\">HtmlEncode[[" + displayName + "]]</label>", labelForModelResult.ToString());
|
||||
Assert.Equal("<label for=\"\">HtmlEncode[[" + displayName + "]]</label>", HtmlContentUtilities.HtmlContentToString(labelResult));
|
||||
Assert.Equal("<label for=\"\">HtmlEncode[[" + displayName + "]]</label>", HtmlContentUtilities.HtmlContentToString(labelForResult));
|
||||
Assert.Equal("<label for=\"\">HtmlEncode[[" + displayName + "]]</label>", HtmlContentUtilities.HtmlContentToString(labelForModelResult));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -173,10 +174,10 @@ namespace Microsoft.AspNet.Mvc.Core
|
|||
var labelForModelResult = helper.LabelForModel();
|
||||
|
||||
// Assert
|
||||
Assert.Empty(labelResult.ToString());
|
||||
Assert.Empty(labelNullResult.ToString());
|
||||
Assert.Empty(labelForResult.ToString());
|
||||
Assert.Empty(labelForModelResult.ToString());
|
||||
Assert.Empty(HtmlContentUtilities.HtmlContentToString(labelResult));
|
||||
Assert.Empty(HtmlContentUtilities.HtmlContentToString(labelNullResult));
|
||||
Assert.Empty(HtmlContentUtilities.HtmlContentToString(labelForResult));
|
||||
Assert.Empty(HtmlContentUtilities.HtmlContentToString(labelForModelResult));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
|
|
@ -197,8 +198,8 @@ namespace Microsoft.AspNet.Mvc.Core
|
|||
var labelForResult = helper.LabelFor(m => m.Property1);
|
||||
|
||||
// Assert
|
||||
Assert.Equal("<label for=\"HtmlEncode[[Property1]]\">HtmlEncode[[" + displayName + "]]</label>", labelResult.ToString());
|
||||
Assert.Equal("<label for=\"HtmlEncode[[Property1]]\">HtmlEncode[[" + displayName + "]]</label>", labelForResult.ToString());
|
||||
Assert.Equal("<label for=\"HtmlEncode[[Property1]]\">HtmlEncode[[" + displayName + "]]</label>", HtmlContentUtilities.HtmlContentToString(labelResult));
|
||||
Assert.Equal("<label for=\"HtmlEncode[[Property1]]\">HtmlEncode[[" + displayName + "]]</label>", HtmlContentUtilities.HtmlContentToString(labelForResult));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
|
|
@ -219,7 +220,7 @@ namespace Microsoft.AspNet.Mvc.Core
|
|||
|
||||
// Assert
|
||||
// Label() falls back to expression name when DisplayName and PropertyName are null.
|
||||
Assert.Equal("<label for=\"HtmlEncode[[" + expectedId + "]]\">HtmlEncode[[" + expectedText + "]]</label>", result.ToString());
|
||||
Assert.Equal("<label for=\"HtmlEncode[[" + expectedId + "]]\">HtmlEncode[[" + expectedText + "]]</label>", HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -247,7 +248,7 @@ namespace Microsoft.AspNet.Mvc.Core
|
|||
var result = helper.LabelFor(model => unknownKey);
|
||||
|
||||
// Assert
|
||||
Assert.Equal("<label for=\"HtmlEncode[[unknownKey]]\">HtmlEncode[[unknownKey]]</label>", result.ToString());
|
||||
Assert.Equal("<label for=\"HtmlEncode[[unknownKey]]\">HtmlEncode[[unknownKey]]</label>", HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
private sealed class InnerClass
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.AspNet.Mvc.TestCommon;
|
||||
using Microsoft.Framework.Internal;
|
||||
using Moq;
|
||||
using Xunit;
|
||||
|
|
@ -78,10 +79,10 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
hostname: hostname,
|
||||
fragment: fragment,
|
||||
routeValues: routeValues,
|
||||
htmlAttributes: htmlAttributes).ToString();
|
||||
htmlAttributes: htmlAttributes);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedLink, actualLink);
|
||||
Assert.Equal(expectedLink, HtmlContentUtilities.HtmlContentToString(actualLink));
|
||||
}
|
||||
|
||||
public static IEnumerable<object[]> RouteLinkGenerationData
|
||||
|
|
@ -141,10 +142,10 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
hostName: hostname,
|
||||
fragment: fragment,
|
||||
routeValues: routeValues,
|
||||
htmlAttributes: htmlAttributes).ToString();
|
||||
htmlAttributes: htmlAttributes);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedLink, actualLink);
|
||||
Assert.Equal(expectedLink, HtmlContentUtilities.HtmlContentToString(actualLink));
|
||||
}
|
||||
|
||||
private string GetRouteValuesAsString(object routeValues)
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ using System.ComponentModel.DataAnnotations;
|
|||
using System.Globalization;
|
||||
using System.Linq.Expressions;
|
||||
using Microsoft.AspNet.Mvc.ModelBinding;
|
||||
using Microsoft.AspNet.Mvc.TestCommon;
|
||||
using Microsoft.AspNet.Testing;
|
||||
using Xunit;
|
||||
|
||||
|
|
@ -51,7 +52,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var result = helper.Password("Property1", value: null, htmlAttributes: attributes);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
|
|
@ -68,7 +69,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var result = helper.Password("Property1", "explicit-value", attributes);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -84,7 +85,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var result = helper.Password("Property1", "explicit-value", htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -102,7 +103,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var result = helper.Password("Property1", "explicit-value", htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -118,7 +119,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var result = helper.Password(name, "explicit-value", htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -159,7 +160,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var result = helper.Password("Property1", value: null, htmlAttributes: attributes);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -176,7 +177,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var result = helper.Password("Property2", value: null, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
public static IEnumerable<object[]> PasswordWithComplexExpressions_UsesIdDotSeparatorData
|
||||
|
|
@ -212,7 +213,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var result = helper.Password(expression, value: null, htmlAttributes: attributes);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
|
|
@ -230,7 +231,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var result = helper.PasswordFor(m => m.Property1, htmlAttributes);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -245,7 +246,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var result = helper.PasswordFor(m => m.Property1, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -267,7 +268,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var result = helper.PasswordFor(m => m.Property1, attributes);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -284,7 +285,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var result = helper.PasswordFor(m => m.Property2, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
public static TheoryData PasswordFor_WithComplexExpressionsData
|
||||
|
|
@ -338,7 +339,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var result = helper.PasswordFor(expression, attributes);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
private static ViewDataDictionary<PasswordModel> GetViewDataWithNullModelAndNonEmptyViewData()
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ using System.Collections.Generic;
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using Microsoft.AspNet.Mvc.ModelBinding;
|
||||
using Microsoft.AspNet.Mvc.TestCommon;
|
||||
using Microsoft.AspNet.Testing;
|
||||
using Microsoft.Framework.Internal;
|
||||
using Microsoft.Framework.WebEncoders;
|
||||
|
|
@ -334,7 +335,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.DropDownList("Property1", selectList, optionLabel: null, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedHtml, html.ToString());
|
||||
Assert.Equal(expectedHtml, HtmlContentUtilities.HtmlContentToString(html));
|
||||
Assert.Equal(savedDisabled, selectList.Select(item => item.Disabled));
|
||||
Assert.Equal(savedGroup, selectList.Select(item => item.Group));
|
||||
Assert.Equal(savedSelected, selectList.Select(item => item.Selected));
|
||||
|
|
@ -358,7 +359,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.DropDownList("Property1", selectList: null, optionLabel: null, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedHtml, html.ToString());
|
||||
Assert.Equal(expectedHtml, HtmlContentUtilities.HtmlContentToString(html));
|
||||
Assert.Equal(savedSelected, selectList.Select(item => item.Selected));
|
||||
}
|
||||
|
||||
|
|
@ -399,7 +400,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.DropDownList("Property1", selectList, optionLabel: null, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedHtml, html.ToString());
|
||||
Assert.Equal(expectedHtml, HtmlContentUtilities.HtmlContentToString(html));
|
||||
Assert.Equal(savedSelected, selectList.Select(item => item.Selected));
|
||||
}
|
||||
|
||||
|
|
@ -439,7 +440,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.DropDownList("Property1", SourcesSelectList, optionLabel: null, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedHtml, html.ToString());
|
||||
Assert.Equal(expectedHtml, HtmlContentUtilities.HtmlContentToString(html));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -481,7 +482,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.DropDownList("Property1", SourcesSelectList, optionLabel: null, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedHtml, html.ToString());
|
||||
Assert.Equal(expectedHtml, HtmlContentUtilities.HtmlContentToString(html));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -506,7 +507,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.DropDownList("Property1", SourcesSelectList, optionLabel: null, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedHtml, html.ToString());
|
||||
Assert.Equal(expectedHtml, HtmlContentUtilities.HtmlContentToString(html));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -534,7 +535,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.DropDownList("Property1", SourcesSelectList, optionLabel: null, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedHtml, html.ToString());
|
||||
Assert.Equal(expectedHtml, HtmlContentUtilities.HtmlContentToString(html));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -561,7 +562,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.DropDownList("Property1", SourcesSelectList, optionLabel: null, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedHtml, html.ToString());
|
||||
Assert.Equal(expectedHtml, HtmlContentUtilities.HtmlContentToString(html));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -577,7 +578,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.DropDownList("Property1", SourcesSelectList, optionLabel: null, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedHtml, html.ToString());
|
||||
Assert.Equal(expectedHtml, HtmlContentUtilities.HtmlContentToString(html));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -594,7 +595,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.DropDownList("Property1", SourcesSelectList, optionLabel: null, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedHtml, html.ToString());
|
||||
Assert.Equal(expectedHtml, HtmlContentUtilities.HtmlContentToString(html));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
|
|
@ -616,7 +617,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedHtml, html.ToString());
|
||||
Assert.Equal(expectedHtml, HtmlContentUtilities.HtmlContentToString(html));
|
||||
Assert.Equal(savedSelected, selectList.Select(item => item.Selected));
|
||||
}
|
||||
|
||||
|
|
@ -640,7 +641,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedHtml, html.ToString());
|
||||
Assert.Equal(expectedHtml, HtmlContentUtilities.HtmlContentToString(html));
|
||||
Assert.Equal(savedSelected, selectList.Select(item => item.Selected));
|
||||
}
|
||||
|
||||
|
|
@ -664,7 +665,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedHtml, html.ToString());
|
||||
Assert.Equal(expectedHtml, HtmlContentUtilities.HtmlContentToString(html));
|
||||
Assert.Equal(savedSelected, selectList.Select(item => item.Selected));
|
||||
}
|
||||
|
||||
|
|
@ -689,7 +690,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedHtml, html.ToString());
|
||||
Assert.Equal(expectedHtml, HtmlContentUtilities.HtmlContentToString(html));
|
||||
Assert.Equal(savedSelected, selectList.Select(item => item.Selected));
|
||||
}
|
||||
|
||||
|
|
@ -717,7 +718,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedHtml, html.ToString());
|
||||
Assert.Equal(expectedHtml, HtmlContentUtilities.HtmlContentToString(html));
|
||||
Assert.Equal(savedSelected, selectList.Select(item => item.Selected));
|
||||
}
|
||||
|
||||
|
|
@ -740,7 +741,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.DropDownListFor(value => unrelated, selectList, optionLabel: null, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedHtml, html.ToString());
|
||||
Assert.Equal(expectedHtml, HtmlContentUtilities.HtmlContentToString(html));
|
||||
Assert.Equal(savedSelected, selectList.Select(item => item.Selected));
|
||||
}
|
||||
|
||||
|
|
@ -764,7 +765,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.ListBox("Property1", selectList, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedHtml, html.ToString());
|
||||
Assert.Equal(expectedHtml, HtmlContentUtilities.HtmlContentToString(html));
|
||||
Assert.Equal(savedDisabled, selectList.Select(item => item.Disabled));
|
||||
Assert.Equal(savedGroup, selectList.Select(item => item.Group));
|
||||
Assert.Equal(savedSelected, selectList.Select(item => item.Selected));
|
||||
|
|
@ -789,7 +790,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.ListBox("Property1", selectList, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedHtml, html.ToString());
|
||||
Assert.Equal(expectedHtml, HtmlContentUtilities.HtmlContentToString(html));
|
||||
Assert.Equal(savedSelected, selectList.Select(item => item.Selected));
|
||||
}
|
||||
|
||||
|
|
@ -810,7 +811,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.ListBox("Property1", selectList, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedHtml, html.ToString());
|
||||
Assert.Equal(expectedHtml, HtmlContentUtilities.HtmlContentToString(html));
|
||||
Assert.Equal(savedSelected, selectList.Select(item => item.Selected));
|
||||
}
|
||||
|
||||
|
|
@ -850,7 +851,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.ListBox("Property1", SourcesSelectList, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedHtml, html.ToString());
|
||||
Assert.Equal(expectedHtml, HtmlContentUtilities.HtmlContentToString(html));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -892,7 +893,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.ListBox("Property1", SourcesSelectList, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedHtml, html.ToString());
|
||||
Assert.Equal(expectedHtml, HtmlContentUtilities.HtmlContentToString(html));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -917,7 +918,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.ListBox("Property1", SourcesSelectList, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedHtml, html.ToString());
|
||||
Assert.Equal(expectedHtml, HtmlContentUtilities.HtmlContentToString(html));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -945,7 +946,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.ListBox("Property1", SourcesSelectList, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedHtml, html.ToString());
|
||||
Assert.Equal(expectedHtml, HtmlContentUtilities.HtmlContentToString(html));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -972,7 +973,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.ListBox("Property1", SourcesSelectList, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedHtml, html.ToString());
|
||||
Assert.Equal(expectedHtml, HtmlContentUtilities.HtmlContentToString(html));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -988,7 +989,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.ListBox("Property1", SourcesSelectList, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedHtml, html.ToString());
|
||||
Assert.Equal(expectedHtml, HtmlContentUtilities.HtmlContentToString(html));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -1005,7 +1006,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.ListBox("Property1", SourcesSelectList, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedHtml, html.ToString());
|
||||
Assert.Equal(expectedHtml, HtmlContentUtilities.HtmlContentToString(html));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
|
|
@ -1024,7 +1025,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.ListBoxFor(value => value.Property1, selectList, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedHtml, html.ToString());
|
||||
Assert.Equal(expectedHtml, HtmlContentUtilities.HtmlContentToString(html));
|
||||
Assert.Equal(savedSelected, selectList.Select(item => item.Selected));
|
||||
}
|
||||
|
||||
|
|
@ -1045,7 +1046,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.ListBoxFor(value => value.Property1, selectList, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedHtml, html.ToString());
|
||||
Assert.Equal(expectedHtml, HtmlContentUtilities.HtmlContentToString(html));
|
||||
Assert.Equal(savedSelected, selectList.Select(item => item.Selected));
|
||||
}
|
||||
|
||||
|
|
@ -1069,7 +1070,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.ListBoxFor(value => unrelated, selectList, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedHtml, html.ToString());
|
||||
Assert.Equal(expectedHtml, HtmlContentUtilities.HtmlContentToString(html));
|
||||
Assert.Equal(savedSelected, selectList.Select(item => item.Selected));
|
||||
}
|
||||
|
||||
|
|
@ -1090,7 +1091,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.ListBoxFor(value => value.Property1, selectList, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedHtml, html.ToString());
|
||||
Assert.Equal(expectedHtml, HtmlContentUtilities.HtmlContentToString(html));
|
||||
Assert.Equal(savedSelected, selectList.Select(item => item.Selected));
|
||||
}
|
||||
|
||||
|
|
@ -1118,7 +1119,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedHtml, html.ToString());
|
||||
Assert.Equal(expectedHtml, HtmlContentUtilities.HtmlContentToString(html));
|
||||
Assert.Equal(savedDisabled, selectList.Select(item => item.Disabled));
|
||||
Assert.Equal(savedGroup, selectList.Select(item => item.Group));
|
||||
Assert.Equal(savedSelected, selectList.Select(item => item.Selected));
|
||||
|
|
@ -1146,7 +1147,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedHtml, html.ToString());
|
||||
Assert.Equal(expectedHtml, HtmlContentUtilities.HtmlContentToString(html));
|
||||
Assert.Equal(savedSelected, selectList.Select(item => item.Selected));
|
||||
}
|
||||
|
||||
|
|
@ -1166,7 +1167,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.DropDownListFor(value => value, selectList, optionLabel: null, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedHtml, html.ToString());
|
||||
Assert.Equal(expectedHtml, HtmlContentUtilities.HtmlContentToString(html));
|
||||
Assert.Equal(savedSelected, selectList.Select(item => item.Selected));
|
||||
}
|
||||
|
||||
|
|
@ -1186,7 +1187,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.DropDownListFor(value => value, selectList, optionLabel: null, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedHtml, html.ToString());
|
||||
Assert.Equal(expectedHtml, HtmlContentUtilities.HtmlContentToString(html));
|
||||
Assert.Equal(savedSelected, selectList.Select(item => item.Selected));
|
||||
}
|
||||
|
||||
|
|
@ -1211,7 +1212,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.ListBox(expression: string.Empty, selectList: selectList, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedHtml, html.ToString());
|
||||
Assert.Equal(expectedHtml, HtmlContentUtilities.HtmlContentToString(html));
|
||||
Assert.Equal(savedDisabled, selectList.Select(item => item.Disabled));
|
||||
Assert.Equal(savedGroup, selectList.Select(item => item.Group));
|
||||
Assert.Equal(savedSelected, selectList.Select(item => item.Selected));
|
||||
|
|
@ -1237,7 +1238,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.ListBox(expression: string.Empty, selectList: selectList, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedHtml, html.ToString());
|
||||
Assert.Equal(expectedHtml, HtmlContentUtilities.HtmlContentToString(html));
|
||||
Assert.Equal(savedSelected, selectList.Select(item => item.Selected));
|
||||
}
|
||||
|
||||
|
|
@ -1258,7 +1259,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.ListBoxFor(value => value, selectList, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedHtml, html.ToString());
|
||||
Assert.Equal(expectedHtml, HtmlContentUtilities.HtmlContentToString(html));
|
||||
Assert.Equal(savedSelected, selectList.Select(item => item.Selected));
|
||||
}
|
||||
|
||||
|
|
@ -1280,7 +1281,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
var html = helper.ListBoxFor(value => value, selectList, htmlAttributes: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedHtml, html.ToString());
|
||||
Assert.Equal(expectedHtml, HtmlContentUtilities.HtmlContentToString(html));
|
||||
Assert.Equal(savedSelected, selectList.Select(item => item.Selected));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Microsoft.AspNet.Mvc.ModelBinding;
|
||||
using Microsoft.AspNet.Mvc.TestCommon;
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.AspNet.Mvc.Rendering
|
||||
|
|
@ -150,7 +151,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
tag: tag);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
|
|
@ -222,7 +223,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
tag: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
|
|
@ -248,7 +249,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
tag: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
|
|
@ -273,7 +274,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
tag: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
|
|
@ -297,7 +298,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
tag: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -330,7 +331,7 @@ namespace Microsoft.AspNet.Mvc.Rendering
|
|||
tag: null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expected, result.ToString());
|
||||
Assert.Equal(expected, HtmlContentUtilities.HtmlContentToString(result));
|
||||
}
|
||||
|
||||
// Adds errors for various parts of the model, including the root.
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ using System.IO;
|
|||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.Testing;
|
||||
using Microsoft.Framework.Internal;
|
||||
using Microsoft.Framework.WebEncoders.Testing;
|
||||
using Xunit;
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,46 @@
|
|||
// 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 System.IO;
|
||||
using Microsoft.Framework.WebEncoders.Testing;
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.AspNet.Mvc.Rendering
|
||||
{
|
||||
public class StringHtmlContentTest
|
||||
{
|
||||
[Fact]
|
||||
public void ToString_ReturnsAString()
|
||||
{
|
||||
// Arrange & Act
|
||||
var content = new StringHtmlContent("Hello World");
|
||||
|
||||
// Assert
|
||||
Assert.Equal("Hello World", content.ToString());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ToString_ReturnsNullForNullInput()
|
||||
{
|
||||
// Arrange & Act
|
||||
var content = new StringHtmlContent(null);
|
||||
|
||||
// Assert
|
||||
Assert.Null(content.ToString());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void WriteTo_WritesContent()
|
||||
{
|
||||
// Arrange & Act
|
||||
var content = new StringHtmlContent("Hello World");
|
||||
|
||||
// Assert
|
||||
using (var writer = new StringWriter())
|
||||
{
|
||||
content.WriteTo(writer, new CommonTestEncoder());
|
||||
Assert.Equal("HtmlEncode[[Hello World]]", writer.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.AspNet.Mvc.Rendering;
|
||||
using Microsoft.AspNet.Mvc.TestCommon;
|
||||
using Microsoft.Framework.WebEncoders.Testing;
|
||||
using Xunit;
|
||||
|
||||
|
|
@ -29,7 +30,7 @@ namespace Microsoft.AspNet.Mvc.Core.Rendering
|
|||
public void MergeAttribute_IgnoresCase(bool replaceExisting, string expectedKey, string expectedValue)
|
||||
{
|
||||
// Arrange
|
||||
var tagBuilder = new TagBuilder("p", new NullTestEncoder());
|
||||
var tagBuilder = new TagBuilder("p");
|
||||
tagBuilder.Attributes.Add("Hello", "World");
|
||||
|
||||
// Act
|
||||
|
|
@ -44,7 +45,7 @@ namespace Microsoft.AspNet.Mvc.Core.Rendering
|
|||
public void AddCssClass_IgnoresCase()
|
||||
{
|
||||
// Arrange
|
||||
var tagBuilder = new TagBuilder("p", new NullTestEncoder());
|
||||
var tagBuilder = new TagBuilder("p");
|
||||
tagBuilder.Attributes.Add("ClaSs", "btn");
|
||||
|
||||
// Act
|
||||
|
|
@ -59,7 +60,7 @@ namespace Microsoft.AspNet.Mvc.Core.Rendering
|
|||
public void GenerateId_IgnoresCase()
|
||||
{
|
||||
// Arrange
|
||||
var tagBuilder = new TagBuilder("p", new NullTestEncoder());
|
||||
var tagBuilder = new TagBuilder("p");
|
||||
tagBuilder.Attributes.Add("ID", "something");
|
||||
|
||||
// Act
|
||||
|
|
@ -75,16 +76,16 @@ namespace Microsoft.AspNet.Mvc.Core.Rendering
|
|||
public void ToString_IgnoresIdAttributeCase(TagRenderMode renderingMode, string expectedOutput)
|
||||
{
|
||||
// Arrange
|
||||
var tagBuilder = new TagBuilder("p", new NullTestEncoder());
|
||||
var tagBuilder = new TagBuilder("p");
|
||||
|
||||
// An empty value id attribute should not be rendered via ToString.
|
||||
tagBuilder.Attributes.Add("ID", string.Empty);
|
||||
|
||||
// Act
|
||||
var value = tagBuilder.ToString(renderingMode);
|
||||
var value = tagBuilder.ToHtmlContent(renderingMode);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedOutput, value);
|
||||
Assert.Equal(expectedOutput, HtmlContentUtilities.HtmlContentToString(value, new NullTestEncoder()));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
|
|
@ -92,29 +93,31 @@ namespace Microsoft.AspNet.Mvc.Core.Rendering
|
|||
public void ToHtmlString_IgnoresIdAttributeCase(TagRenderMode renderingMode, string expectedOutput)
|
||||
{
|
||||
// Arrange
|
||||
var tagBuilder = new TagBuilder("p", new NullTestEncoder());
|
||||
var tagBuilder = new TagBuilder("p");
|
||||
|
||||
// An empty value id attribute should not be rendered via ToHtmlString.
|
||||
tagBuilder.Attributes.Add("ID", string.Empty);
|
||||
|
||||
// Act
|
||||
var value = tagBuilder.ToHtmlString(renderingMode);
|
||||
var value = tagBuilder.ToHtmlContent(renderingMode);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedOutput, value.ToString());
|
||||
Assert.Equal(expectedOutput, HtmlContentUtilities.HtmlContentToString(value, new NullTestEncoder()));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SetInnerText_HtmlEncodesValue()
|
||||
{
|
||||
// Arrange
|
||||
var tagBuilder = new TagBuilder("p", new CommonTestEncoder());
|
||||
var tagBuilder = new TagBuilder("p");
|
||||
|
||||
// Act
|
||||
tagBuilder.SetInnerText("TestValue");
|
||||
|
||||
// Assert
|
||||
Assert.Equal("HtmlEncode[[TestValue]]", tagBuilder.InnerHtml);
|
||||
Assert.Equal(
|
||||
"HtmlEncode[[TestValue]]",
|
||||
HtmlContentUtilities.HtmlContentToString(tagBuilder.InnerHtml));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
|
|
|
|||
|
|
@ -25,10 +25,10 @@ namespace ActivatorWebSite.TagHelpers
|
|||
{
|
||||
(HtmlHelper as ICanHasViewContext)?.Contextualize(ViewContext);
|
||||
|
||||
var builder = new TagBuilder("h2", HtmlHelper.HtmlEncoder);
|
||||
var builder = new TagBuilder("h2");
|
||||
var title = ViewContext.ViewBag.Title;
|
||||
builder.InnerHtml = HtmlHelper.Encode(title);
|
||||
output.PreContent.SetContent(builder.ToString());
|
||||
builder.SetInnerText(title);
|
||||
output.PreContent.SetContent(builder.ToHtmlContent(TagRenderMode.Normal));
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue