diff options
Diffstat (limited to 'libgo/go/html/template/transition.go')
-rw-r--r-- | libgo/go/html/template/transition.go | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/libgo/go/html/template/transition.go b/libgo/go/html/template/transition.go index aefe0355af4..4a4716d7820 100644 --- a/libgo/go/html/template/transition.go +++ b/libgo/go/html/template/transition.go @@ -105,14 +105,21 @@ func tTag(c context, s []byte) (context, int) { err: errorf(ErrBadHTML, nil, 0, "expected space, attr name, or end of tag, but got %q", s[i:]), }, len(s) } - switch attrType(string(s[i:j])) { - case contentTypeURL: - attr = attrURL - case contentTypeCSS: - attr = attrStyle - case contentTypeJS: - attr = attrScript + + attrName := string(s[i:j]) + if c.element == elementScript && attrName == "type" { + attr = attrScriptType + } else { + switch attrType(attrName) { + case contentTypeURL: + attr = attrURL + case contentTypeCSS: + attr = attrStyle + case contentTypeJS: + attr = attrScript + } } + if j == len(s) { state = stateAttrName } else { @@ -149,10 +156,11 @@ func tAfterName(c context, s []byte) (context, int) { } var attrStartStates = [...]state{ - attrNone: stateAttr, - attrScript: stateJS, - attrStyle: stateCSS, - attrURL: stateURL, + attrNone: stateAttr, + attrScript: stateJS, + attrScriptType: stateAttr, + attrStyle: stateCSS, + attrURL: stateURL, } // tBeforeValue is the context transition function for stateBeforeValue. |