Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(2574)

Issue 4968058: code review 4968058: exp/template/html: autoescape actions in HTML style att... (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 7 months ago by MikeSamuel
Modified:
12 years, 7 months ago
Reviewers:
CC:
nigeltao, golang-dev
Visibility:
Public.

Description

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 http://codereview.appspot.com/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.

Patch Set 1 #

Patch Set 2 : diff -r 3fc0b72a3ad7 https://go.googlecode.com/hg/ #

Patch Set 3 : diff -r 3fc0b72a3ad7 https://go.googlecode.com/hg/ #

Patch Set 4 : diff -r 3fc0b72a3ad7 https://go.googlecode.com/hg/ #

Patch Set 5 : diff -r 3fc0b72a3ad7 https://go.googlecode.com/hg/ #

Patch Set 6 : diff -r 3fc0b72a3ad7 https://go.googlecode.com/hg/ #

Patch Set 7 : diff -r 3fc0b72a3ad7 https://go.googlecode.com/hg/ #

Patch Set 8 : diff -r 3fc0b72a3ad7 https://go.googlecode.com/hg/ #

Patch Set 9 : diff -r 3fc0b72a3ad7 https://go.googlecode.com/hg/ #

Total comments: 38

Patch Set 10 : diff -r cfa7b2e1dd91 https://go.googlecode.com/hg/ #

Patch Set 11 : diff -r cfa7b2e1dd91 https://go.googlecode.com/hg/ #

Patch Set 12 : diff -r 56fb1fd74279 https://go.googlecode.com/hg/ #

Total comments: 24

Patch Set 13 : diff -r 56fb1fd74279 https://go.googlecode.com/hg/ #

Patch Set 14 : diff -r edec078c7e7e https://go.googlecode.com/hg/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1400 lines, -86 lines) Patch
M src/pkg/exp/template/html/Makefile View 1 1 chunk +3 lines, -0 lines 0 comments Download
M src/pkg/exp/template/html/context.go View 1 2 chunks +37 lines, -13 lines 0 comments Download
A src/pkg/exp/template/html/css.go View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +255 lines, -0 lines 0 comments Download
A src/pkg/exp/template/html/css_test.go View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +277 lines, -0 lines 0 comments Download
M src/pkg/exp/template/html/escape.go View 1 2 3 4 5 6 7 8 9 10 11 12 9 chunks +210 lines, -61 lines 0 comments Download
M src/pkg/exp/template/html/escape_test.go View 1 2 3 4 5 6 7 chunks +243 lines, -11 lines 0 comments Download
A src/pkg/exp/template/html/html.go View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +101 lines, -0 lines 0 comments Download
A src/pkg/exp/template/html/html_test.go View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +57 lines, -0 lines 0 comments Download
M src/pkg/exp/template/html/js.go View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +1 line, -1 line 0 comments Download
A src/pkg/exp/template/html/url.go View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +104 lines, -0 lines 0 comments Download
A src/pkg/exp/template/html/url_test.go View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +112 lines, -0 lines 0 comments Download

Messages

Total messages: 6
MikeSamuel
Hello nigeltao@golang.org (cc: golang-dev@googlegroups.com), I'd like you to review this change to https://go.googlecode.com/hg/
12 years, 7 months ago (2011-09-01 23:07:42 UTC) #1
nigeltao
This is quite a lot of code to digest. I've made mostly superficial comments for ...
12 years, 7 months ago (2011-09-02 09:11:37 UTC) #2
MikeSamuel
Incremental diffs at http://codereview.appspot.com/4968058/diff2/21001:10004/src/pkg/exp/template/html/css.go http://codereview.appspot.com/4968058/diff/21001/src/pkg/exp/template/html/css.go File src/pkg/exp/template/html/css.go (right): http://codereview.appspot.com/4968058/diff/21001/src/pkg/exp/template/html/css.go#newcode14 src/pkg/exp/template/html/css.go:14: // endsWithCSSKeyword is true iff ...
12 years, 7 months ago (2011-09-02 17:07:43 UTC) #3
nigeltao
LGTM. http://codereview.appspot.com/4968058/diff/21001/src/pkg/exp/template/html/css.go File src/pkg/exp/template/html/css.go (right): http://codereview.appspot.com/4968058/diff/21001/src/pkg/exp/template/html/css.go#newcode56 src/pkg/exp/template/html/css.go:56: // decodeCSS decodes CSS3 escapes given a sequence ...
12 years, 7 months ago (2011-09-06 01:54:08 UTC) #4
MikeSamuel
http://codereview.appspot.com/4968058/diff/21001/src/pkg/exp/template/html/css.go File src/pkg/exp/template/html/css.go (right): http://codereview.appspot.com/4968058/diff/21001/src/pkg/exp/template/html/css.go#newcode56 src/pkg/exp/template/html/css.go:56: // decodeCSS decodes CSS3 escapes given a sequence of ...
12 years, 7 months ago (2011-09-06 04:28:16 UTC) #5
nigeltao
12 years, 7 months ago (2011-09-08 21:18:26 UTC) #6
*** Submitted as http://code.google.com/p/go/source/detail?r=504f4e9b079c ***

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 http://codereview.appspot.com/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
http://codereview.appspot.com/4968058

Committer: Nigel Tao <nigeltao@golang.org>
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b