From 35819729b83b8521e9ae1bddca5c368672777de5 Mon Sep 17 00:00:00 2001 From: Mike Samuel Date: Wed, 21 Sep 2011 21:38:40 -0700 Subject: [PATCH] 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",