From e73e73acddf824260aed9d8be761543bb793ba61 Mon Sep 17 00:00:00 2001 From: "N. Taylor Mullen" Date: Fri, 14 Aug 2015 12:11:05 -0700 Subject: [PATCH] Add `srcset` to list of application relative resolvable URLs. - Now allow the attribute to exist on `img` and `source` tags. - Updated existing `UrlResolutionTagHelper` functional test to validate `srcset` attribute. #2964 --- .../TagHelpers/UrlResolutionTagHelper.cs | 6 ++++-- .../resources/RazorWebSite.UrlResolution.Index.Encoded.html | 4 ++-- .../resources/RazorWebSite.UrlResolution.Index.html | 4 ++-- test/WebSites/RazorWebSite/Views/UrlResolution/Index.cshtml | 4 ++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/Microsoft.AspNet.Mvc.Razor/TagHelpers/UrlResolutionTagHelper.cs b/src/Microsoft.AspNet.Mvc.Razor/TagHelpers/UrlResolutionTagHelper.cs index 400e6895ce..a413e2cfde 100644 --- a/src/Microsoft.AspNet.Mvc.Razor/TagHelpers/UrlResolutionTagHelper.cs +++ b/src/Microsoft.AspNet.Mvc.Razor/TagHelpers/UrlResolutionTagHelper.cs @@ -31,6 +31,7 @@ namespace Microsoft.AspNet.Mvc.Razor.TagHelpers [TargetElement("html", Attributes = "manifest")] [TargetElement("iframe", Attributes = "src")] [TargetElement("img", Attributes = "src", TagStructure = TagStructure.WithoutEndTag)] + [TargetElement("img", Attributes = "srcset", TagStructure = TagStructure.WithoutEndTag)] [TargetElement("input", Attributes = "src", TagStructure = TagStructure.WithoutEndTag)] [TargetElement("input", Attributes = "formaction", TagStructure = TagStructure.WithoutEndTag)] [TargetElement("ins", Attributes = "cite")] @@ -41,6 +42,7 @@ namespace Microsoft.AspNet.Mvc.Razor.TagHelpers [TargetElement("q", Attributes = "cite")] [TargetElement("script", Attributes = "src")] [TargetElement("source", Attributes = "src", TagStructure = TagStructure.WithoutEndTag)] + [TargetElement("source", Attributes = "srcset", TagStructure = TagStructure.WithoutEndTag)] [TargetElement("track", Attributes = "src", TagStructure = TagStructure.WithoutEndTag)] [TargetElement("video", Attributes = "src")] [TargetElement("video", Attributes = "poster")] @@ -65,7 +67,7 @@ namespace Microsoft.AspNet.Mvc.Razor.TagHelpers { "form", new[] { "action" } }, { "html", new[] { "manifest" } }, { "iframe", new[] { "src" } }, - { "img", new[] { "src" } }, + { "img", new[] { "src", "srcset" } }, { "input", new[] { "src", "formaction" } }, { "ins", new[] { "cite" } }, { "link", new[] { "href" } }, @@ -73,7 +75,7 @@ namespace Microsoft.AspNet.Mvc.Razor.TagHelpers { "object", new[] { "archive", "data" } }, { "q", new[] { "cite" } }, { "script", new[] { "src" } }, - { "source", new[] { "src" } }, + { "source", new[] { "src", "srcset" } }, { "track", new[] { "src" } }, { "video", new[] { "poster", "src" } }, }; diff --git a/test/Microsoft.AspNet.Mvc.FunctionalTests/compiler/resources/RazorWebSite.UrlResolution.Index.Encoded.html b/test/Microsoft.AspNet.Mvc.FunctionalTests/compiler/resources/RazorWebSite.UrlResolution.Index.Encoded.html index 0cf79e7fbe..8a89e575b2 100644 --- a/test/Microsoft.AspNet.Mvc.FunctionalTests/compiler/resources/RazorWebSite.UrlResolution.Index.Encoded.html +++ b/test/Microsoft.AspNet.Mvc.FunctionalTests/compiler/resources/RazorWebSite.UrlResolution.Index.Encoded.html @@ -9,12 +9,12 @@