Commit bca65e39 authored by Nigel Tao's avatar Nigel Tao

html: parse more malformed tags.

This continues the work in revision 914a659b44ff, now passing more test
cases. As before, the new tokenization tests match html5lib's behavior.

Fixes #2124.

R=dsymonds, r
CC=golang-dev
https://golang.org/cl/4867042
parent 6ca968c7
...@@ -429,7 +429,7 @@ loop: ...@@ -429,7 +429,7 @@ loop:
for ; i < z.p1; i++ { for ; i < z.p1; i++ {
c := z.buf[i] c := z.buf[i]
switch c { switch c {
case '<', '>', '"', '\'', '/', '=': case '>', '/', '=':
break loop break loop
} }
switch { switch {
......
...@@ -49,14 +49,24 @@ var tokenTests = []tokenTest{ ...@@ -49,14 +49,24 @@ var tokenTests = []tokenTest{
}, },
{ {
"malformed tag #1", "malformed tag #1",
`<p </p>`,
`<p <="" p="">`,
},
{
"malformed tag #2",
`<p id=0</p>`, `<p id=0</p>`,
`<p id="0&lt;/p">`, `<p id="0&lt;/p">`,
}, },
{ {
"malformed tag #2", "malformed tag #3",
`<p id="0</p>`, `<p id="0</p>`,
`<p id="0&lt;/p&gt;">`, `<p id="0&lt;/p&gt;">`,
}, },
{
"malformed tag #4",
`<p id="0"</p>`,
`<p id="0" <="" p="">`,
},
// Comments. // Comments.
{ {
"comment0", "comment0",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment