]> Cypherpunks repositories - gostls13.git/commitdiff
html/template: replace bytes.Compare call with bytes.Equal
authorguoguangwu <guoguangwu@magic-shield.com>
Tue, 20 Feb 2024 06:20:13 +0000 (06:20 +0000)
committerGopher Robot <gobot@golang.org>
Tue, 27 Feb 2024 16:34:44 +0000 (16:34 +0000)
Change-Id: I1bd3fdf0ceb9a83dbcc07f55b81489eb2c82c9ba
GitHub-Last-Rev: 05d49d7fb921e59529f7105a93b4b7fba51ab525
GitHub-Pull-Request: golang/go#65418
Reviewed-on: https://go-review.googlesource.com/c/go/+/560115
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
src/html/template/transition.go

index d5a05f66da406da9f4eb3ebfc36499115c7e42a1..b897bea54213e53c5ef1fc50b4db27d4d9e88689 100644 (file)
@@ -414,7 +414,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.Compare(bytes.ToLower(s[i-1:i+7]), []byte("</script")) == 0 {
+                       if i > 0 && i+7 <= len(s) && bytes.Equal(bytes.ToLower(s[i-1 : i+7]), []byte("</script")) {
                                i++
                        } else if !inCharset {
                                c.state, c.jsCtx = stateJS, jsCtxDivOp