html/template: use zero-alloc bytes.EqualFold

Change-Id: I2357b88ded7ac9f08848a67115dce6539c3c6428
Reviewed-on: https://go-review.googlesource.com/c/go/+/773820
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Nicholas Husin <husin@google.com>
Reviewed-by: Nicholas Husin <nsh@golang.org>
This commit is contained in:
Neal Patel 2026-05-04 11:27:26 -04:00
parent 66843181d1
commit 3b7d571c99

View file

@ -426,7 +426,7 @@ func tJSDelimited(c context, s []byte) (context, int) {
// If "</script" appears in a regex literal, the '/' should not
// close the regex literal, and it will later be escaped to
// "\x3C/script" in escapeText.
if i > 0 && i+7 <= len(s) && bytes.Equal(bytes.ToLower(s[i-1:i+7]), []byte("</script")) {
if i > 0 && i+7 <= len(s) && bytes.EqualFold(s[i-1:i+7], []byte("</script")) {
i++
} else if !inCharset {
c.state, c.jsCtx = stateJS, jsCtxDivOp