From b8d88d2b469b05c2095d7c63a07ffe0634aab861 Mon Sep 17 00:00:00 2001 From: Salih Date: Thu, 16 May 2024 16:07:38 +0300 Subject: [PATCH] Update ScriptTagHelper.cs --- .../Mvc/UI/Bundling/TagHelpers/ScriptTagHelper.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/ScriptTagHelper.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/ScriptTagHelper.cs index 2328b73baf..452b726c96 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/ScriptTagHelper.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/ScriptTagHelper.cs @@ -11,9 +11,6 @@ public class ScriptTagHelper : AbpTagHelper { protected AbpBundlingOptions Options { get; } - [HtmlAttributeName("src")] - public string Src { get; set; } = default!; - public ScriptTagHelper(IOptions options) { Options = options.Value; @@ -25,7 +22,9 @@ public class ScriptTagHelper : AbpTagHelper output.Attributes.Add("defer", ""); } - if (!Src.IsNullOrWhiteSpace() && Options.DeferScripts.Any(x => Src.Equals(x, StringComparison.OrdinalIgnoreCase))) + var src = output.Attributes["src"]?.Value?.ToString(); + + if (!src.IsNullOrWhiteSpace() && Options.DeferScripts.Any(x => src.Equals(x, StringComparison.OrdinalIgnoreCase))) { output.Attributes.Add("defer", ""); }