diff --git a/src/pkg/exp/html/escape.go b/src/pkg/exp/html/escape.go
index 6a9d8f6e6f..7827dc2d50 100644
--- a/src/pkg/exp/html/escape.go
+++ b/src/pkg/exp/html/escape.go
@@ -163,14 +163,15 @@ func unescapeEntity(b []byte, dst, src int, attribute bool) (dst1, src1 int) {
}
// unescape unescapes b's entities in-place, so that "a<b" becomes "a"
PASS "
"
PASS ""
PASS ""
-FAIL ""
-FAIL ""
-FAIL ""
-FAIL ""
-FAIL ""
+PASS ""
+PASS ""
+PASS ""
+PASS ""
+PASS ""
PASS ""
PASS ""
PASS ""
@@ -15,7 +15,7 @@ PASS ""
PASS ""
PASS ""
PASS ""
-FAIL ""
+PASS ""
PASS ""
PASS "ZZ£_id=23
"
PASS "ZZ&prod_id=23
"
diff --git a/src/pkg/exp/html/token.go b/src/pkg/exp/html/token.go
index 4ca0a90b34..b20de87bee 100644
--- a/src/pkg/exp/html/token.go
+++ b/src/pkg/exp/html/token.go
@@ -741,7 +741,7 @@ func (z *Tokenizer) Text() []byte {
z.data.end = z.raw.end
s = convertNewlines(s)
if !z.textIsRaw {
- s = unescape(s)
+ s = unescape(s, false)
}
return s
}
@@ -775,7 +775,7 @@ func (z *Tokenizer) TagAttr() (key, val []byte, moreAttr bool) {
z.nAttrReturned++
key = z.buf[x[0].start:x[0].end]
val = z.buf[x[1].start:x[1].end]
- return lower(key), unescape(convertNewlines(val)), z.nAttrReturned < len(z.attr)
+ return lower(key), unescape(convertNewlines(val), true), z.nAttrReturned < len(z.attr)
}
}
return nil, nil, false
diff --git a/src/pkg/exp/html/token_test.go b/src/pkg/exp/html/token_test.go
index a802bf3f2c..5209d139bb 100644
--- a/src/pkg/exp/html/token_test.go
+++ b/src/pkg/exp/html/token_test.go
@@ -370,14 +370,11 @@ var tokenTests = []tokenTest{
`<&alsoDoesntExist;&`,
`$<&alsoDoesntExist;&`,
},
- /*
- // TODO: re-enable this test when it works. This input/output matches html5lib's behavior.
- {
- "entity without semicolon",
- `¬it;∉`,
- `¬it;∉$`,
- },
- */
+ {
+ "entity without semicolon",
+ `¬it;∉`,
+ `¬it;∉$`,
+ },
{
"entity with digits",
"½",