]> Cypherpunks repositories - gostls13.git/commit
exp/template/html: error out on ambiguous unquoted attributes
authorMike Samuel <mikesamuel@gmail.com>
Mon, 26 Sep 2011 07:42:38 +0000 (00:42 -0700)
committerMike Samuel <mikesamuel@gmail.com>
Mon, 26 Sep 2011 07:42:38 +0000 (00:42 -0700)
commit66cdd020382760e502fe456f753156f6fa6a2867
treebc0f13292d11b3a2544991f285593b6b8a1fc6a8
parentb3d8e6d7f456eac13f29b21a9930e2b2ce0c4cae
exp/template/html: error out on ambiguous unquoted attributes

HTML parsers may differ on whether
<input id= onchange=f(             ends in id's or onchange's value,
<a class=`foo                      ends inside a value,
<input style=font:'Arial'          needs open-quote fixup.

Per
http://www.w3.org/TR/html5/tokenization.html#attribute-value-unquoted-state
this treats the error cases in 8.2.4.40 Attribute value (unquoted) state
as fatal errors.

\> U+0022 QUOTATION MARK (")
\> U+0027 APOSTROPHE (')
\> U+003C LESS-THAN SIGN (<)
\> U+003D EQUALS SIGN (=)
\> U+0060 GRAVE ACCENT (`)
        Parse error. Treat it as per the "anything else" entry below.

and emits ErrBadHTML.

R=nigeltao
CC=golang-dev
https://golang.org/cl/5085050
src/pkg/exp/template/html/escape.go
src/pkg/exp/template/html/escape_test.go