Skip to content

Commit ae4f311

Browse files
donkerbdukes
authored andcommitted
Logic fixes and allow empty attribute values to render as such
1 parent 792e0dc commit ae4f311

4 files changed

Lines changed: 4 additions & 4 deletions

File tree

DNN Platform/DotNetNuke.Web.Client.ResourceManager/Models/FontResource.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public override string Render(int crmVersion, bool useCdn, string applicationPat
3737
{
3838
htmlString.Append($" rel=\"preload\" as=\"font\"");
3939
}
40-
else if (!this.Attributes.ContainsKey("rel"))
40+
else if (!this.Preload && !this.Attributes.ContainsKey("rel"))
4141
{
4242
htmlString.Append($" rel=\"font\"");
4343
}

DNN Platform/DotNetNuke.Web.Client.ResourceManager/Models/ResourceBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ protected void RenderAttributes(StringBuilder htmlString)
239239
{
240240
foreach (var attribute in this.Attributes)
241241
{
242-
if (string.IsNullOrEmpty(attribute.Value))
242+
if (attribute.Value is null)
243243
{
244244
htmlString.Append($" {attribute.Key}");
245245
}

DNN Platform/DotNetNuke.Web.Client.ResourceManager/Models/StylesheetResource.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public override string Render(int crmVersion, bool useCdn, string applicationPat
4141
{
4242
htmlString.Append($" rel=\"preload\" as=\"style\"");
4343
}
44-
else if (!this.Attributes.ContainsKey("rel"))
44+
else if (!this.Preload && !this.Attributes.ContainsKey("rel"))
4545
{
4646
htmlString.Append($" rel=\"stylesheet\"");
4747
}

DNN Platform/DotNetNuke.Web.Client/Controls/ClientResourceInclude.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ private static void ParseHtmlAttributesIntoDictionary(string attributes, IDictio
139139
if (isKey && c == ' ')
140140
{
141141
// this means we have a key without a value, we should add it to the dictionary with an empty value and start a new key
142-
destination[key] = string.Empty;
142+
destination[key] = null;
143143
key = string.Empty;
144144
continue;
145145
}

0 commit comments

Comments
 (0)