diff --git a/html/comment_test.go b/html/comment_test.go
index 2c80bc748c..fd47de8773 100644
--- a/html/comment_test.go
+++ b/html/comment_test.go
@@ -6,12 +6,13 @@ package html
import (
"bytes"
+ "strings"
"testing"
)
// TestComments exhaustively tests every 'interesting' N-byte string is
-// correctly parsed as a comment. N ranges from 4+1 to 4+suffixLen inclusive,
-// where 4 is the length of the ""); err != nil {
diff --git a/html/token.go b/html/token.go
index 50f7c6aac8..5c2a1f4efa 100644
--- a/html/token.go
+++ b/html/token.go
@@ -110,7 +110,7 @@ func (t Token) String() string {
case SelfClosingTagToken:
return "<" + t.tagString() + "/>"
case CommentToken:
- return ""
+ return ""
case DoctypeToken:
return ""
}
@@ -598,10 +598,10 @@ scriptDataDoubleEscapeEnd:
// readComment reads the next comment token starting with "`
-const issue58246Rendered = ``
type tokenTest struct {
// A short description of the test case.
@@ -332,7 +324,7 @@ var tokenTests = []tokenTest{
{
"comment3",
"az",
- "a$$z",
+ "a$$z",
},
{
"comment4",
@@ -352,7 +344,7 @@ var tokenTests = []tokenTest{
{
"comment7",
"a",
+ "a$",
},
{
"comment8",
@@ -407,12 +399,12 @@ var tokenTests = []tokenTest{
{
"comment18",
"az",
- "a$$z",
+ "a$$z",
},
{
"comment19",
"a",
+ "a$",
},
{
"comment20",
@@ -427,7 +419,7 @@ var tokenTests = []tokenTest{
{
"comment22",
"az",
- "a$$z",
+ "a$$z",
},
{
"comment23",
@@ -437,27 +429,27 @@ var tokenTests = []tokenTest{
{
"comment24",
"a",
+ "a$",
},
{
"comment25",
"a",
+ "a$",
},
{
"comment26",
"a",
+ "a$",
},
{
"comment27",
"az",
- "a$$z",
+ "a$$z",
},
{
"comment28",
"az",
- "a$$z",
+ "a$$z",
},
{
"comment29",
@@ -469,10 +461,20 @@ var tokenTests = []tokenTest{
"az",
"a$$z",
},
+ {
+ "comment31",
+ "az",
+ "a$$z",
+ },
+ {
+ "comment32",
+ "az",
+ "a$$z",
+ },
// https://stackoverflow.design/email/base/mso/#targeting-specific-outlook-versions
// says "[For] Windows Outlook 2003 and above... conditional comments allow
// us to add bits of HTML that are only read by the Word-based versions of
- // Outlook". TODO: these comments (with angle brackets) should pass through
+ // Outlook". These comments (with angle brackets) should pass through
// unchanged (by this Go package) when rendering.
//
// We should also still escape ">" as ">" when necessary.
@@ -484,22 +486,22 @@ var tokenTests = []tokenTest{
{
"issue48237CommentWithAmpgtsemi1",
"az",
- "a$$z",
+ "a$$z",
},
{
"issue48237CommentWithAmpgtsemi2",
"az",
- "a$$z",
+ "a$$z",
},
{
"issue58246MicrosoftOutlookComment1",
"az",
- "a$$z",
+ "a$$z",
},
{
"issue58246MicrosoftOutlookComment2",
"a" + issue58246 + "z",
- "a$" + issue58246Rendered + "$z",
+ "a$" + issue58246 + "$z",
},
// An attribute with a backslash.
{