From 891dfa5e3e493aed206d04b92601cbfd6a0c941c Mon Sep 17 00:00:00 2001 From: Ajay Bhargav Baaskaran Date: Tue, 23 Dec 2014 14:59:16 -0800 Subject: [PATCH] renamed TagNameAttribute to HtmlElementNameAttribute --- .../Properties/Resources.Designer.cs | 8 ++++---- src/Microsoft.AspNet.Razor.Runtime/Resources.resx | 2 +- ...gNameAttribute.cs => HtmlElementNameAttribute.cs} | 12 ++++++------ .../TagHelpers/TagHelperDescriptorFactory.cs | 2 +- .../TagHelpers/TagHelperDescriptorFactoryTest.cs | 10 +++++----- 5 files changed, 17 insertions(+), 17 deletions(-) rename src/Microsoft.AspNet.Razor.Runtime/TagHelpers/{TagNameAttribute.cs => HtmlElementNameAttribute.cs} (73%) diff --git a/src/Microsoft.AspNet.Razor.Runtime/Properties/Resources.Designer.cs b/src/Microsoft.AspNet.Razor.Runtime/Properties/Resources.Designer.cs index 98672b3cef..c8d7f462c1 100644 --- a/src/Microsoft.AspNet.Razor.Runtime/Properties/Resources.Designer.cs +++ b/src/Microsoft.AspNet.Razor.Runtime/Properties/Resources.Designer.cs @@ -81,17 +81,17 @@ namespace Microsoft.AspNet.Razor.Runtime /// /// Parameter {0} must not contain null tag names. /// - internal static string TagNameAttribute_AdditionalTagsCannotContainNull + internal static string HtmlElementNameAttribute_AdditionalTagsCannotContainNull { - get { return GetString("TagNameAttribute_AdditionalTagsCannotContainNull"); } + get { return GetString("HtmlElementNameAttribute_AdditionalTagsCannotContainNull"); } } /// /// Parameter {0} must not contain null tag names. /// - 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); } /// diff --git a/src/Microsoft.AspNet.Razor.Runtime/Resources.resx b/src/Microsoft.AspNet.Razor.Runtime/Resources.resx index d6222dec62..6865dc5932 100644 --- a/src/Microsoft.AspNet.Razor.Runtime/Resources.resx +++ b/src/Microsoft.AspNet.Razor.Runtime/Resources.resx @@ -131,7 +131,7 @@ Must call '{2}.{1}' before calling '{2}.{0}'. - + Parameter {0} must not contain null tag names. diff --git a/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/TagNameAttribute.cs b/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/HtmlElementNameAttribute.cs similarity index 73% rename from src/Microsoft.AspNet.Razor.Runtime/TagHelpers/TagNameAttribute.cs rename to src/Microsoft.AspNet.Razor.Runtime/TagHelpers/HtmlElementNameAttribute.cs index 91d06d193f..f575de2c6c 100644 --- a/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/TagNameAttribute.cs +++ b/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/HtmlElementNameAttribute.cs @@ -11,29 +11,29 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers /// Used to override a 's default tag name target. /// [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)] - public sealed class TagNameAttribute : Attribute + public sealed class HtmlElementNameAttribute : Attribute { /// - /// Instantiates a new instance of the class. + /// Instantiates a new instance of the class. /// /// The HTML tag name for the to target. - public TagNameAttribute([NotNull] string tag) + public HtmlElementNameAttribute([NotNull] string tag) { Tags = new[] { tag }; } /// - /// Instantiates a new instance of the class. + /// Instantiates a new instance of the class. /// /// The HTML tag name for the to target. /// Additional HTML tag names for the to target. - 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(additionalTags); diff --git a/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/TagHelperDescriptorFactory.cs b/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/TagHelperDescriptorFactory.cs index 51e3954325..eef0babed5 100644 --- a/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/TagHelperDescriptorFactory.cs +++ b/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/TagHelperDescriptorFactory.cs @@ -43,7 +43,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers private static IEnumerable GetTagNames(Type tagHelperType) { var typeInfo = tagHelperType.GetTypeInfo(); - var attributes = typeInfo.GetCustomAttributes(inherit: false); + var attributes = typeInfo.GetCustomAttributes(inherit: false); // If there isn't an attribute specifying the tag name derive it from the name if (!attributes.Any()) diff --git a/test/Microsoft.AspNet.Razor.Runtime.Test/TagHelpers/TagHelperDescriptorFactoryTest.cs b/test/Microsoft.AspNet.Razor.Runtime.Test/TagHelpers/TagHelperDescriptorFactoryTest.cs index 072d68b323..b68c041578 100644 --- a/test/Microsoft.AspNet.Razor.Runtime.Test/TagHelpers/TagHelperDescriptorFactoryTest.cs +++ b/test/Microsoft.AspNet.Razor.Runtime.Test/TagHelpers/TagHelperDescriptorFactoryTest.cs @@ -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 { }