Skip to content

Commit

Permalink
Added support for AngleSharp 0.14.0
Browse files Browse the repository at this point in the history
  • Loading branch information
egil committed Apr 16, 2020
1 parent 4acdbf5 commit 98e4546
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 0.14.0

Released on Wednesday, April 1, 2020.
Released on Wednesday, April 16, 2020.

- Bug: custom whitespace options on `<pre>`/`<style>`/`<script>` not being applied during comparison.
- Upgraded to version 0.14.0 of AngleSharp.
Expand Down
12 changes: 6 additions & 6 deletions src/AngleSharp.Diffing/Extensions/ElementExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public static bool TryGetAttrValue(this IElement element, string attributeName,
/// Try to get an attribute value off of an element.
/// Returns true when the attribute was found, false otherwise.
/// </summary>
public static bool TryGetAttrValue(this IElement element, string attributeName, [NotNullWhen(true)]out string result)
public static bool TryGetAttrValue(this IElement element, string attributeName, [NotNullWhen(true)] out string result)
{
return TryGetAttrValue(element, attributeName, GetStringAttrValue, out result);

Expand All @@ -48,7 +48,7 @@ public static bool TryGetAttrValue<T>(this IElement element, string attributeNam
/// Try to get an attribute value off of an element.
/// Returns true when the attribute was found, false otherwise.
/// </summary>
public static bool TryGetAttrValue<T>(this IElement element, string attributeName, Func<string, T> resultFunc, [NotNullWhen(true)] out T result)
public static bool TryGetAttrValue<T>(this IElement element, string attributeName, Func<string, T> resultFunc, [NotNullWhen(true)] out T result) where T : notnull
{
if (element is null)
throw new ArgumentNullException(nameof(element));
Expand All @@ -62,9 +62,9 @@ public static bool TryGetAttrValue<T>(this IElement element, string attributeNam
}
else
{
#pragma warning disable CS8653 // A default expression introduces a null value for a type parameter.
result = default;
#pragma warning restore CS8653 // A default expression introduces a null value for a type parameter.
#pragma warning disable CS8601 // Possible null reference assignment.
result = default(T);
#pragma warning restore CS8601 // Possible null reference assignment.
return false;
}
}
Expand Down Expand Up @@ -112,7 +112,7 @@ public static T GetInlineOptionOrDefault<T>(this IElement startElement, string o
/// Try to get the index of the node in its parent's ChildNodes list.
/// Returns true if index was found. False otherwise.
/// </summary>
public static bool TryGetNodeIndex(this INode node, [NotNullWhen(true)]out int index)
public static bool TryGetNodeIndex(this INode node, [NotNullWhen(true)] out int index)
{
index = -1;

Expand Down
14 changes: 7 additions & 7 deletions src/AngleSharp.Diffing/Extensions/NodeExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public static bool HasAttributes(this INode node)
/// Try to get an attribute with the <paramref name="attributeName"/> from the <paramref name="node"/>.
/// Returns true if the attribute exists, false otherwise.
/// </summary>
public static bool TryGetAttr(this INode node, string attributeName, [NotNullWhen(true)]out IAttr? attribute)
public static bool TryGetAttr(this INode node, string attributeName, [NotNullWhen(true)] out IAttr? attribute)
{
if (node is IElement element && element.HasAttribute(attributeName))
{
Expand Down Expand Up @@ -52,7 +52,7 @@ public static bool TryGetAttrValue(this INode node, string attributeName, out bo
/// Try to get an attribute value off of an element.
/// Returns true when the attribute was found, false otherwise.
/// </summary>
public static bool TryGetAttrValue(this INode node, string attributeName, [NotNullWhen(true)]out string result)
public static bool TryGetAttrValue(this INode node, string attributeName, [NotNullWhen(true)] out string result)
{
#pragma warning disable CS8625 // Cannot convert null literal to non-nullable reference type.
result = default;
Expand All @@ -66,21 +66,21 @@ public static bool TryGetAttrValue(this INode node, string attributeName, [NotNu
/// </summary>
public static bool TryGetAttrValue<T>(this INode node, string attributeName, out T result) where T : System.Enum
{
#pragma warning disable CS8653 // A default expression introduces a null value for a type parameter.
#pragma warning disable CS8601 // Possible null reference assignment.
result = default;
#pragma warning restore CS8653 // A default expression introduces a null value for a type parameter.
#pragma warning restore CS8601 // Possible null reference assignment.
return node is IElement element && element.TryGetAttrValue(attributeName, out result);
}

/// <summary>
/// Try to get an attribute value off of an element.
/// Returns true when the attribute was found, false otherwise.
/// </summary>
public static bool TryGetAttrValue<T>(this INode node, string attributeName, Func<string, T> resultFunc, [NotNullWhen(true)] out T result)
public static bool TryGetAttrValue<T>(this INode node, string attributeName, Func<string, T> resultFunc, [NotNullWhen(true)] out T result) where T : notnull
{
#pragma warning disable CS8653 // A default expression introduces a null value for a type parameter.
#pragma warning disable CS8601 // Possible null reference assignment.
result = default;
#pragma warning restore CS8653 // A default expression introduces a null value for a type parameter.
#pragma warning restore CS8601 // Possible null reference assignment.
return node is IElement element && element.TryGetAttrValue(attributeName, resultFunc, out result);
}

Expand Down

0 comments on commit 98e4546

Please sign in to comment.