From c515e20e75e6e10991fd2acc3b96f9f5089b3a35 Mon Sep 17 00:00:00 2001 From: Jonathan Magnan Date: Fri, 4 Feb 2022 09:42:52 -0500 Subject: [PATCH] Update source --- .../HtmlAttributeCollection.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/HtmlAgilityPack.Shared/HtmlAttributeCollection.cs b/src/HtmlAgilityPack.Shared/HtmlAttributeCollection.cs index 23eadea5..410fdc65 100644 --- a/src/HtmlAgilityPack.Shared/HtmlAttributeCollection.cs +++ b/src/HtmlAgilityPack.Shared/HtmlAttributeCollection.cs @@ -230,7 +230,18 @@ public void Insert(int index, HtmlAttribute item) /// bool ICollection.Remove(HtmlAttribute item) { - Remove(item); + if (item == null) + { + return false; + } + + int index = GetAttributeIndex(item); + if (index == -1) + { + return false; + } + + RemoveAt(index); return true; }