@@ -3,6 +3,7 @@ namespace AngleSharp.Css.Values
33 using AngleSharp . Css . Dom ;
44 using AngleSharp . Text ;
55 using System ;
6+ using System . Collections . Generic ;
67
78 /// <summary>
89 /// Represents a CSS border image definition.
@@ -111,7 +112,7 @@ public String CssText
111112
112113 #endregion
113114
114- #region
115+ #region Methods
115116
116117 /// <summary>
117118 /// Checks if the current value is equal to the provided one.
@@ -120,11 +121,17 @@ public String CssText
120121 /// <returns>True if both are equal, otherwise false.</returns>
121122 public Boolean Equals ( CssBorderImageValue other )
122123 {
123- return _image . Equals ( other . _image ) &&
124- _slice . Equals ( other . _slice ) &&
125- _widths . Equals ( other . _widths ) &&
126- _outsets . Equals ( other . _outsets ) &&
127- _repeat . Equals ( other . _repeat ) ;
124+ if ( other is not null )
125+ {
126+ var comparer = EqualityComparer < ICssValue > . Default ;
127+ return comparer . Equals ( _image , other . _image ) &&
128+ comparer . Equals ( _slice , other . _slice ) &&
129+ comparer . Equals ( _widths , other . _widths ) &&
130+ comparer . Equals ( _outsets , other . _outsets ) &&
131+ comparer . Equals ( _repeat , other . _repeat ) ;
132+ }
133+
134+ return false ;
128135 }
129136
130137 Boolean IEquatable < ICssValue > . Equals ( ICssValue other ) => other is CssBorderImageValue value && Equals ( value ) ;
@@ -137,7 +144,7 @@ ICssValue ICssValue.Compute(ICssComputeContext context)
137144 var offsets = _outsets . Compute ( context ) ;
138145 var repeat = _repeat . Compute ( context ) ;
139146 return new CssBorderImageValue ( image , slice , widths , offsets , repeat ) ;
140- }
147+ }
141148
142149 #endregion
143150 }
0 commit comments