Skip to content

Commit d8ef262

Browse files
author
Warren Buckley
authored
Remove the nested region
1 parent a60f3ea commit d8ef262

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

Our.Umbraco.TagHelpers/ImgTagHelper.cs

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -180,15 +180,13 @@ public override void Process(TagHelperContext context, TagHelperOutput output)
180180
height = (originalHeight / originalWidth) * width;
181181
}
182182

183-
#region Autogenerate alt text
183+
#region Autogenerate alt text if unspecfied
184184
if (string.IsNullOrWhiteSpace(ImgAlt))
185185
{
186186
output.Attributes.Add("alt", GetImageAltText(MediaItem));
187187
}
188-
#endregion
189-
#region Use the alt text the user specified
190-
else
191-
{
188+
else
189+
{
192190
output.Attributes.Add("alt", ImgAlt);
193191
}
194192
#endregion
@@ -201,18 +199,16 @@ public override void Process(TagHelperContext context, TagHelperOutput output)
201199

202200
imgSrc = AddQueryToUrl(FileSource, "width", width.ToString());
203201

204-
#region Autogenerate alt text
202+
#region Autogenerate alt text if unspecfied
205203
if (string.IsNullOrWhiteSpace(ImgAlt))
206204
{
207205
output.Attributes.Add("alt", GetImageAltText(FileSource));
208206
}
209-
#endregion
210-
#region Use the alt text the user specified
211-
else
212-
{
213-
output.Attributes.Add("alt", ImgAlt);
214-
}
215-
#endregion
207+
else
208+
{
209+
output.Attributes.Add("alt", ImgAlt);
210+
}
211+
#endregion
216212

217213
#region If width & height are not defined then return a basic <img> with just a src, alt & class (if provided)
218214
if (ImgWidth == 0 || ImgHeight == 0)

0 commit comments

Comments
 (0)