]> Cypherpunks repositories - gostls13.git/commit
exp/template/html: autoescape actions in HTML style attributes.
authorMike Samuel <mikesamuel@gmail.com>
Thu, 8 Sep 2011 21:18:20 +0000 (07:18 +1000)
committerNigel Tao <nigeltao@golang.org>
Thu, 8 Sep 2011 21:18:20 +0000 (07:18 +1000)
commit4670d9e6349119914c9a5a1b40ce32045f3c0061
tree74c209cb5b1a1d7d37ff0aa4774244e80c6693bf
parent66b3fabf17595d68c35ee3ab761f186ebf274f48
exp/template/html: autoescape actions in HTML style attributes.

This does not wire up <style> elements as that is pending support
for raw text content in CL https://golang.org/cl/4964045/

This CL allows actions to appear in contexts like

selectors:        {{.Tag}}{{.Class}}{{.Id}}
property names:   border-{{.BidiLeadingEdge}}
property values:  color: {{.Color}}
strings:          font-family: "{{font-name}}"
URL strings:      background: "/foo?image={{.ImgQuery}}"
URL literals:     background: url("{{.Image}}")

but disallows actions inside CSS comments and disallows
embedding of JS in CSS entirely.

It is based on the CSS3 lexical grammar with affordances for
common browser extensions including line comments.

R=nigeltao
CC=golang-dev
https://golang.org/cl/4968058
src/pkg/exp/template/html/Makefile
src/pkg/exp/template/html/context.go
src/pkg/exp/template/html/css.go [new file with mode: 0644]
src/pkg/exp/template/html/css_test.go [new file with mode: 0644]
src/pkg/exp/template/html/escape.go
src/pkg/exp/template/html/escape_test.go
src/pkg/exp/template/html/html.go [new file with mode: 0644]
src/pkg/exp/template/html/html_test.go [new file with mode: 0644]
src/pkg/exp/template/html/js.go
src/pkg/exp/template/html/url.go [new file with mode: 0644]
src/pkg/exp/template/html/url_test.go [new file with mode: 0644]