This repository was archived by the owner on Dec 14, 2018. It is now read-only.

Description
I'm not sure why there is a need to render empty list element ('HiddenListItem ') in validation summary tag:
|
private const string HiddenListItem = @"<li style=""display:none""></li>"; |
|
if (!isHtmlSummaryModified) |
|
{ |
|
htmlSummary.InnerHtml.AppendEncoded(HiddenListItem); |
|
htmlSummary.InnerHtml.AppendLine(); |
|
} |
When there is no errors the resulting html is:
<div class="text-danger validation-summary-valid" data-valmsg-summary="true">
<ul>
<li style="display:none"></li>
</ul>
</div>
The client side implementation does not care about elements of the list itself, they are always cleared:
https://github.com/aspnet/jquery-validation-unobtrusive/blob/master/jquery.validate.unobtrusive.js#L58-L70
The reason I noticed this is that screen readers/crawlers see that list, even if empty (empty list just adds noise to markup):

It would be better to just not render that empty element on server:
<div class="text-danger validation-summary-valid" data-valmsg-summary="true">
<ul></ul>
</div>
Just a little detail.
Thanks!