Cleanup some IDE warnings
This commit is contained in:
parent
b2a1a7c9de
commit
ddde149792
|
|
@ -257,8 +257,7 @@ namespace Microsoft.AspNetCore.Mvc.TagHelpers
|
||||||
// not function properly.
|
// not function properly.
|
||||||
Href = output.Attributes[HrefAttributeName]?.Value as string;
|
Href = output.Attributes[HrefAttributeName]?.Value as string;
|
||||||
|
|
||||||
Mode mode;
|
if (!AttributeMatcher.TryDetermineMode(context, ModeDetails, Compare, out var mode))
|
||||||
if (!AttributeMatcher.TryDetermineMode(context, ModeDetails, Compare, out mode))
|
|
||||||
{
|
{
|
||||||
// No attributes matched so we have nothing to do
|
// No attributes matched so we have nothing to do
|
||||||
return;
|
return;
|
||||||
|
|
@ -295,8 +294,7 @@ namespace Microsoft.AspNetCore.Mvc.TagHelpers
|
||||||
|
|
||||||
if (mode == Mode.Fallback && HasStyleSheetLinkType(output.Attributes))
|
if (mode == Mode.Fallback && HasStyleSheetLinkType(output.Attributes))
|
||||||
{
|
{
|
||||||
string resolvedUrl;
|
if (TryResolveUrl(FallbackHref, resolvedUrl: out string resolvedUrl))
|
||||||
if (TryResolveUrl(FallbackHref, resolvedUrl: out resolvedUrl))
|
|
||||||
{
|
{
|
||||||
FallbackHref = resolvedUrl;
|
FallbackHref = resolvedUrl;
|
||||||
}
|
}
|
||||||
|
|
@ -395,17 +393,15 @@ namespace Microsoft.AspNetCore.Mvc.TagHelpers
|
||||||
|
|
||||||
private bool HasStyleSheetLinkType(TagHelperAttributeList attributes)
|
private bool HasStyleSheetLinkType(TagHelperAttributeList attributes)
|
||||||
{
|
{
|
||||||
TagHelperAttribute relAttribute;
|
if (!attributes.TryGetAttribute(RelAttributeName, out var relAttribute) ||
|
||||||
if (!attributes.TryGetAttribute(RelAttributeName, out relAttribute) ||
|
|
||||||
relAttribute.Value == null)
|
relAttribute.Value == null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var attributeValue = relAttribute.Value;
|
var attributeValue = relAttribute.Value;
|
||||||
var contentValue = attributeValue as IHtmlContent;
|
|
||||||
var stringValue = attributeValue as string;
|
var stringValue = attributeValue as string;
|
||||||
if (contentValue != null)
|
if (attributeValue is IHtmlContent contentValue)
|
||||||
{
|
{
|
||||||
contentValue.WriteTo(StringWriter, HtmlEncoder);
|
contentValue.WriteTo(StringWriter, HtmlEncoder);
|
||||||
stringValue = StringWriter.ToString();
|
stringValue = StringWriter.ToString();
|
||||||
|
|
|
||||||
|
|
@ -221,8 +221,7 @@ namespace Microsoft.AspNetCore.Mvc.TagHelpers
|
||||||
// not function properly.
|
// not function properly.
|
||||||
Src = output.Attributes[SrcAttributeName]?.Value as string;
|
Src = output.Attributes[SrcAttributeName]?.Value as string;
|
||||||
|
|
||||||
Mode mode;
|
if (!AttributeMatcher.TryDetermineMode(context, ModeDetails, Compare, out var mode))
|
||||||
if (!AttributeMatcher.TryDetermineMode(context, ModeDetails, Compare, out mode))
|
|
||||||
{
|
{
|
||||||
// No attributes matched so we have nothing to do
|
// No attributes matched so we have nothing to do
|
||||||
return;
|
return;
|
||||||
|
|
@ -259,8 +258,7 @@ namespace Microsoft.AspNetCore.Mvc.TagHelpers
|
||||||
|
|
||||||
if (mode == Mode.Fallback)
|
if (mode == Mode.Fallback)
|
||||||
{
|
{
|
||||||
string resolvedUrl;
|
if (TryResolveUrl(FallbackSrc, resolvedUrl: out string resolvedUrl))
|
||||||
if (TryResolveUrl(FallbackSrc, resolvedUrl: out resolvedUrl))
|
|
||||||
{
|
{
|
||||||
FallbackSrc = resolvedUrl;
|
FallbackSrc = resolvedUrl;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue