Skip to content

Commit

Permalink
Fix indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
euju-ms committed Oct 30, 2024
1 parent 7189e53 commit 1c20bd3
Showing 1 changed file with 30 additions and 30 deletions.
60 changes: 30 additions & 30 deletions src/HtmlAgilityPack.Shared/HtmlNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1524,36 +1524,36 @@ public T GetAttributeValue<T>(string name, T def)
/// <param name="def">The default value to return if not found.</param>
/// <param name="parser">The parser used to convert string attribute value to T.</param>
/// <returns>The value of the attribute if found and parsable, the default value otherwise.</returns>
public T GetAttributeValue<T>(string name, T def, AttributeValueParser<T> parser)
{
if (name == null)
{
throw new ArgumentNullException(nameof(name));
}

if (!HasAttributes)
{
return def;
}

HtmlAttribute att = Attributes[name];
if (att?.Value == null)
{
return def;
}

if (att.Value is T value)
{
return value;
}

if (parser != null && parser(att.Value, out T parsedValue))
{
return parsedValue;
}

return def;
}
public T GetAttributeValue<T>(string name, T def, AttributeValueParser<T> parser)
{
if (name == null)
{
throw new ArgumentNullException(nameof(name));
}

if (!HasAttributes)
{
return def;
}

HtmlAttribute att = Attributes[name];
if (att?.Value == null)
{
return def;
}

if (att.Value is T value)
{
return value;
}

if (parser != null && parser(att.Value, out T parsedValue))
{
return parsedValue;
}

return def;
}
#endif

/// <summary>
Expand Down

0 comments on commit 1c20bd3

Please sign in to comment.