From: Mike Samuel Date: Thu, 22 Sep 2011 04:38:40 +0000 (-0700) Subject: exp/template/html: elide comments in template source. X-Git-Tag: weekly.2011-09-21~1 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=35819729b83b8521e9ae1bddca5c368672777de5;p=gostls13.git exp/template/html: elide comments in template source. When templates are stored in external files, developers often embed comments to explain&|disable code. {{if .C}}...{{else}}{{end}} This unnecessarily increases the size of shipped HTML and can leak information. This change elides all comments of the following types: 1. comments found in source. 2. /*...*/ and // comments found in ", - "", }, { @@ -405,8 +404,8 @@ func TestEscape(t *testing.T) { // Newline separates break from call. If newline // removed, then break will consume label leaving // code invalid. - "", + "", }, { "JS single-line block comment", @@ -417,25 +416,25 @@ func TestEscape(t *testing.T) { // removed, then break will consume label leaving // code invalid. "", }, { "JS block comment flush with mathematical division", "", - "", + "", }, { "JS mixed comments", "", - "", + "", }, { "CSS comments", "`, - "", + "", }, { "JS attr block comment", @@ -462,12 +461,12 @@ func TestEscape(t *testing.T) { { "HTML substitution commented out", "

", - "

", + "

", }, { "Comment ends flush with start", "", - "", + "", }, { "typed HTML in text",