]> Cypherpunks repositories - gostls13.git/commitdiff
html: parse more malformed tags.
authorNigel Tao <nigeltao@golang.org>
Thu, 11 Aug 2011 08:49:09 +0000 (18:49 +1000)
committerNigel Tao <nigeltao@golang.org>
Thu, 11 Aug 2011 08:49:09 +0000 (18:49 +1000)
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

src/pkg/html/token.go
src/pkg/html/token_test.go

index fddc922d6016d9903fbfb9fc2c2cf69fdd74b4c0..d266b3a300bb635919f4f8062995535dfac8d9ae 100644 (file)
@@ -429,7 +429,7 @@ loop:
        for ; i < z.p1; i++ {
                c := z.buf[i]
                switch c {
-               case '<', '>', '"', '\'', '/', '=':
+               case '>', '/', '=':
                        break loop
                }
                switch {
index 1330f3247a15ecef2fc30c1a03f57572ee32ac68..0a0beb201b37590eadd98488248adf59ddc7a300 100644 (file)
@@ -49,14 +49,24 @@ var tokenTests = []tokenTest{
        },
        {
                "malformed tag #1",
+               `<p </p>`,
+               `<p <="" p="">`,
+       },
+       {
+               "malformed tag #2",
                `<p id=0</p>`,
                `<p id="0&lt;/p">`,
        },
        {
-               "malformed tag #2",
+               "malformed tag #3",
                `<p id="0</p>`,
                `<p id="0&lt;/p&gt;">`,
        },
+       {
+               "malformed tag #4",
+               `<p id="0"</p>`,
+               `<p id="0" <="" p="">`,
+       },
        // Comments.
        {
                "comment0",