Skip to content

Commit 98e4546

Browse files
committed
Added support for AngleSharp 0.14.0
1 parent 4acdbf5 commit 98e4546

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# 0.14.0
22

3-
Released on Wednesday, April 1, 2020.
3+
Released on Wednesday, April 16, 2020.
44

55
- Bug: custom whitespace options on `<pre>`/`<style>`/`<script>` not being applied during comparison.
66
- Upgraded to version 0.14.0 of AngleSharp.

src/AngleSharp.Diffing/Extensions/ElementExtensions.cs

+6-6
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public static bool TryGetAttrValue(this IElement element, string attributeName,
2626
/// Try to get an attribute value off of an element.
2727
/// Returns true when the attribute was found, false otherwise.
2828
/// </summary>
29-
public static bool TryGetAttrValue(this IElement element, string attributeName, [NotNullWhen(true)]out string result)
29+
public static bool TryGetAttrValue(this IElement element, string attributeName, [NotNullWhen(true)] out string result)
3030
{
3131
return TryGetAttrValue(element, attributeName, GetStringAttrValue, out result);
3232

@@ -48,7 +48,7 @@ public static bool TryGetAttrValue<T>(this IElement element, string attributeNam
4848
/// Try to get an attribute value off of an element.
4949
/// Returns true when the attribute was found, false otherwise.
5050
/// </summary>
51-
public static bool TryGetAttrValue<T>(this IElement element, string attributeName, Func<string, T> resultFunc, [NotNullWhen(true)] out T result)
51+
public static bool TryGetAttrValue<T>(this IElement element, string attributeName, Func<string, T> resultFunc, [NotNullWhen(true)] out T result) where T : notnull
5252
{
5353
if (element is null)
5454
throw new ArgumentNullException(nameof(element));
@@ -62,9 +62,9 @@ public static bool TryGetAttrValue<T>(this IElement element, string attributeNam
6262
}
6363
else
6464
{
65-
#pragma warning disable CS8653 // A default expression introduces a null value for a type parameter.
66-
result = default;
67-
#pragma warning restore CS8653 // A default expression introduces a null value for a type parameter.
65+
#pragma warning disable CS8601 // Possible null reference assignment.
66+
result = default(T);
67+
#pragma warning restore CS8601 // Possible null reference assignment.
6868
return false;
6969
}
7070
}
@@ -112,7 +112,7 @@ public static T GetInlineOptionOrDefault<T>(this IElement startElement, string o
112112
/// Try to get the index of the node in its parent's ChildNodes list.
113113
/// Returns true if index was found. False otherwise.
114114
/// </summary>
115-
public static bool TryGetNodeIndex(this INode node, [NotNullWhen(true)]out int index)
115+
public static bool TryGetNodeIndex(this INode node, [NotNullWhen(true)] out int index)
116116
{
117117
index = -1;
118118

src/AngleSharp.Diffing/Extensions/NodeExtensions.cs

+7-7
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public static bool HasAttributes(this INode node)
2222
/// Try to get an attribute with the <paramref name="attributeName"/> from the <paramref name="node"/>.
2323
/// Returns true if the attribute exists, false otherwise.
2424
/// </summary>
25-
public static bool TryGetAttr(this INode node, string attributeName, [NotNullWhen(true)]out IAttr? attribute)
25+
public static bool TryGetAttr(this INode node, string attributeName, [NotNullWhen(true)] out IAttr? attribute)
2626
{
2727
if (node is IElement element && element.HasAttribute(attributeName))
2828
{
@@ -52,7 +52,7 @@ public static bool TryGetAttrValue(this INode node, string attributeName, out bo
5252
/// Try to get an attribute value off of an element.
5353
/// Returns true when the attribute was found, false otherwise.
5454
/// </summary>
55-
public static bool TryGetAttrValue(this INode node, string attributeName, [NotNullWhen(true)]out string result)
55+
public static bool TryGetAttrValue(this INode node, string attributeName, [NotNullWhen(true)] out string result)
5656
{
5757
#pragma warning disable CS8625 // Cannot convert null literal to non-nullable reference type.
5858
result = default;
@@ -66,21 +66,21 @@ public static bool TryGetAttrValue(this INode node, string attributeName, [NotNu
6666
/// </summary>
6767
public static bool TryGetAttrValue<T>(this INode node, string attributeName, out T result) where T : System.Enum
6868
{
69-
#pragma warning disable CS8653 // A default expression introduces a null value for a type parameter.
69+
#pragma warning disable CS8601 // Possible null reference assignment.
7070
result = default;
71-
#pragma warning restore CS8653 // A default expression introduces a null value for a type parameter.
71+
#pragma warning restore CS8601 // Possible null reference assignment.
7272
return node is IElement element && element.TryGetAttrValue(attributeName, out result);
7373
}
7474

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

0 commit comments

Comments
 (0)