vendor/golang.org/x/net/html/token.go
changeset 265 05c40b36d3b2
parent 260 445e01aede7e
--- a/vendor/golang.org/x/net/html/token.go	Thu Sep 22 16:37:07 2022 +0200
+++ b/vendor/golang.org/x/net/html/token.go	Sat Feb 04 12:58:35 2023 +0100
@@ -605,7 +605,10 @@
 			z.data.end = z.data.start
 		}
 	}()
-	for dashCount := 2; ; {
+
+	var dashCount int
+	beginning := true
+	for {
 		c := z.readByte()
 		if z.err != nil {
 			// Ignore up to two dashes at EOF.
@@ -620,7 +623,7 @@
 			dashCount++
 			continue
 		case '>':
-			if dashCount >= 2 {
+			if dashCount >= 2 || beginning {
 				z.data.end = z.raw.end - len("-->")
 				return
 			}
@@ -638,6 +641,7 @@
 			}
 		}
 		dashCount = 0
+		beginning = false
 	}
 }