TagHelpers attribute targeting - part 3

This commit is contained in:
Ajay Bhargav Baaskaran 2015-03-20 11:42:07 -07:00
parent 29479895cd
commit fd5e07dd03
2 changed files with 19 additions and 3 deletions

View File

@ -18,6 +18,17 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
/// <summary>
/// <see cref="ITagHelper"/> implementation targeting &lt;link&gt; elements that supports fallback href paths.
/// </summary>
/// <remarks>
/// The tag helper won't process for cases with just the 'href' attribute.
/// </remarks>
[TargetElement("link", Attributes = HrefIncludeAttributeName)]
[TargetElement("link", Attributes = HrefExcludeAttributeName)]
[TargetElement("link", Attributes = FallbackHrefAttributeName)]
[TargetElement("link", Attributes = FallbackHrefIncludeAttributeName)]
[TargetElement("link", Attributes = FallbackHrefExcludeAttributeName)]
[TargetElement("link", Attributes = FallbackTestClassAttributeName)]
[TargetElement("link", Attributes = FallbackTestPropertyAttributeName)]
[TargetElement("link", Attributes = FallbackTestValueAttributeName)]
public class LinkTagHelper : TagHelper
{
private const string HrefIncludeAttributeName = "asp-href-include";
@ -233,7 +244,7 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
CultureInfo.InvariantCulture,
"<meta name=\"x-stylesheet-fallback-test\" class=\"{0}\" />",
HtmlEncoder.HtmlEncode(FallbackTestClass)));
// Build the <script /> tag that checks the effective style of <meta /> tag above and renders the extra
// <link /> tag to load the fallback stylesheet if the test CSS property value is found to be false,
// indicating that the primary stylesheet failed to load.

View File

@ -19,9 +19,14 @@ namespace Microsoft.AspNet.Mvc.TagHelpers
/// <see cref="ITagHelper"/> implementation targeting &lt;script&gt; elements that supports fallback src paths.
/// </summary>
/// <remarks>
/// <see cref="FallbackSrc" /> and <see cref="FallbackTestExpression" /> are required to not be
/// <c>null</c> or empty to process.
/// The tag helper won't process for cases with just the 'src' attribute.
/// </remarks>
[TargetElement("script", Attributes = SrcIncludeAttributeName)]
[TargetElement("script", Attributes = SrcExcludeAttributeName)]
[TargetElement("script", Attributes = FallbackSrcAttributeName)]
[TargetElement("script", Attributes = FallbackSrcIncludeAttributeName)]
[TargetElement("script", Attributes = FallbackSrcExcludeAttributeName)]
[TargetElement("script", Attributes = FallbackTestExpressionAttributeName)]
public class ScriptTagHelper : TagHelper
{
private const string SrcIncludeAttributeName = "asp-src-include";