renamed TagNameAttribute to HtmlElementNameAttribute
This commit is contained in:
parent
e30e74dc5a
commit
891dfa5e3e
|
|
@ -81,17 +81,17 @@ namespace Microsoft.AspNet.Razor.Runtime
|
|||
/// <summary>
|
||||
/// Parameter {0} must not contain null tag names.
|
||||
/// </summary>
|
||||
internal static string TagNameAttribute_AdditionalTagsCannotContainNull
|
||||
internal static string HtmlElementNameAttribute_AdditionalTagsCannotContainNull
|
||||
{
|
||||
get { return GetString("TagNameAttribute_AdditionalTagsCannotContainNull"); }
|
||||
get { return GetString("HtmlElementNameAttribute_AdditionalTagsCannotContainNull"); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parameter {0} must not contain null tag names.
|
||||
/// </summary>
|
||||
internal static string FormatTagNameAttribute_AdditionalTagsCannotContainNull(object p0)
|
||||
internal static string FormatHtmlElementNameAttribute_AdditionalTagsCannotContainNull(object p0)
|
||||
{
|
||||
return string.Format(CultureInfo.CurrentCulture, GetString("TagNameAttribute_AdditionalTagsCannotContainNull"), p0);
|
||||
return string.Format(CultureInfo.CurrentCulture, GetString("HtmlElementNameAttribute_AdditionalTagsCannotContainNull"), p0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@
|
|||
<data name="ScopeManager_EndCannotBeCalledWithoutACallToBegin" xml:space="preserve">
|
||||
<value>Must call '{2}.{1}' before calling '{2}.{0}'.</value>
|
||||
</data>
|
||||
<data name="TagNameAttribute_AdditionalTagsCannotContainNull" xml:space="preserve">
|
||||
<data name="HtmlElementNameAttribute_AdditionalTagsCannotContainNull" xml:space="preserve">
|
||||
<value>Parameter {0} must not contain null tag names.</value>
|
||||
</data>
|
||||
<data name="ArgumentCannotBeNullOrEmpty" xml:space="preserve">
|
||||
|
|
|
|||
|
|
@ -11,29 +11,29 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
/// Used to override a <see cref="ITagHelper"/>'s default tag name target.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)]
|
||||
public sealed class TagNameAttribute : Attribute
|
||||
public sealed class HtmlElementNameAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
/// Instantiates a new instance of the <see cref="TagNameAttribute"/> class.
|
||||
/// Instantiates a new instance of the <see cref="HtmlElementNameAttribute"/> class.
|
||||
/// </summary>
|
||||
/// <param name="tag">The HTML tag name for the <see cref="TagHelper"/> to target.</param>
|
||||
public TagNameAttribute([NotNull] string tag)
|
||||
public HtmlElementNameAttribute([NotNull] string tag)
|
||||
{
|
||||
Tags = new[] { tag };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Instantiates a new instance of the <see cref="TagNameAttribute"/> class.
|
||||
/// Instantiates a new instance of the <see cref="HtmlElementNameAttribute"/> class.
|
||||
/// </summary>
|
||||
/// <param name="tag">The HTML tag name for the <see cref="TagHelper"/> to target.</param>
|
||||
/// <param name="additionalTags">Additional HTML tag names for the <see cref="TagHelper"/> to target.</param>
|
||||
public TagNameAttribute([NotNull] string tag, [NotNull] params string[] additionalTags)
|
||||
public HtmlElementNameAttribute([NotNull] string tag, [NotNull] params string[] additionalTags)
|
||||
{
|
||||
if (additionalTags.Contains(null))
|
||||
{
|
||||
throw new ArgumentNullException(
|
||||
nameof(additionalTags),
|
||||
Resources.FormatTagNameAttribute_AdditionalTagsCannotContainNull(nameof(additionalTags)));
|
||||
Resources.FormatHtmlElementNameAttribute_AdditionalTagsCannotContainNull(nameof(additionalTags)));
|
||||
};
|
||||
|
||||
var allTags = new List<string>(additionalTags);
|
||||
|
|
@ -43,7 +43,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
private static IEnumerable<string> GetTagNames(Type tagHelperType)
|
||||
{
|
||||
var typeInfo = tagHelperType.GetTypeInfo();
|
||||
var attributes = typeInfo.GetCustomAttributes<TagNameAttribute>(inherit: false);
|
||||
var attributes = typeInfo.GetCustomAttributes<HtmlElementNameAttribute>(inherit: false);
|
||||
|
||||
// If there isn't an attribute specifying the tag name derive it from the name
|
||||
if (!attributes.Any())
|
||||
|
|
|
|||
|
|
@ -372,7 +372,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
{
|
||||
}
|
||||
|
||||
[TagName("p", "div")]
|
||||
[HtmlElementName("p", "div")]
|
||||
private class MultiTagTagHelper
|
||||
{
|
||||
public string ValidAttribute { get; set; }
|
||||
|
|
@ -382,18 +382,18 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
{
|
||||
}
|
||||
|
||||
[TagName("p", "p", "div", "div")]
|
||||
[HtmlElementName("p", "p", "div", "div")]
|
||||
private class DuplicateTagNameTagHelper
|
||||
{
|
||||
}
|
||||
|
||||
[TagName("data-condition")]
|
||||
[HtmlElementName("data-condition")]
|
||||
private class OverrideNameTagHelper
|
||||
{
|
||||
}
|
||||
|
||||
[TagName("span")]
|
||||
[TagName("div", "p")]
|
||||
[HtmlElementName("span")]
|
||||
[HtmlElementName("div", "p")]
|
||||
private class MultipleAttributeTagHelper
|
||||
{
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue