d6450709f9cb080523713ef9b72c79a5d42fd90b
RemoveClass deleted each class with one strings.ReplaceAll pass over the
space-wrapped class list. Two adjacent occurrences share the space
between them, so " a a " holds only one non-overlapping " a " and the
second survived: RemoveClass("a") on class="a a" returned with
HasClass("a") still true. ToggleClass used the same expression and so
toggled such a class the wrong way.
Replace one occurrence at a time, re-scanning from the start, in a helper
shared by both call sites. Whitespace between the remaining classes is
untouched.
Description
My contributions to PuerkitoBio/goquery: 4 commits, 2 merged PRs
64 KiB
0 Stars
1 Watchers
0 Forks
Languages
Go
100%