mirror of https://github.com/golang/go.git
exp/template/html: fix bug /*/ is not a full JS block comment.
Similar tests for CSS already catch this problem in tCSS. R=nigeltao CC=golang-dev https://golang.org/cl/4967065
This commit is contained in:
parent
3b189d8f9c
commit
80a5ddbdb1
|
|
@ -487,9 +487,9 @@ func tJS(c context, s []byte) (context, []byte) {
|
|||
case '/':
|
||||
switch {
|
||||
case i+1 < len(s) && s[i+1] == '/':
|
||||
c.state = stateJSLineCmt
|
||||
c.state, i = stateJSLineCmt, i+1
|
||||
case i+1 < len(s) && s[i+1] == '*':
|
||||
c.state = stateJSBlockCmt
|
||||
c.state, i = stateJSBlockCmt, i+1
|
||||
case c.jsCtx == jsCtxRegexp:
|
||||
c.state = stateJSRegexp
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -643,6 +643,14 @@ func TestEscapeText(t *testing.T) {
|
|||
`<a onclick="/*`,
|
||||
context{state: stateJSBlockCmt, delim: delimDoubleQuote},
|
||||
},
|
||||
{
|
||||
`<a onclick="/*/`,
|
||||
context{state: stateJSBlockCmt, delim: delimDoubleQuote},
|
||||
},
|
||||
{
|
||||
`<a onclick="/**/`,
|
||||
context{state: stateJS, delim: delimDoubleQuote},
|
||||
},
|
||||
{
|
||||
`<a onkeypress=""`,
|
||||
context{state: stateJSDqStr, delim: delimDoubleQuote},
|
||||
|
|
|
|||
Loading…
Reference in New Issue