]> Cypherpunks repositories - gostls13.git/commitdiff
html: ignore <head> tags in <head> element
authorAndrew Balholm <andybalholm@gmail.com>
Sun, 27 Nov 2011 03:41:08 +0000 (14:41 +1100)
committerNigel Tao <nigeltao@golang.org>
Sun, 27 Nov 2011 03:41:08 +0000 (14:41 +1100)
Pass tests3.dat, test 12:
<!DOCTYPE html><HTML><META><HEAD></HEAD></HTML>

| <!DOCTYPE html>
| <html>
|   <head>
|     <meta>
|   <body>

Also pass tests through test 19:
<!DOCTYPE html><html><head></head><body><ul><li><div><p><li></ul></body></html>

R=nigeltao
CC=golang-dev
https://golang.org/cl/5436069

src/pkg/html/parse.go
src/pkg/html/parse_test.go

index 36a5fd2fdc6b87b8a3a6f77081cfd62de51021f2..723f65a4d7ab292bbafd2834b0fcc76cbdba32ec 100644 (file)
@@ -518,6 +518,9 @@ func inHeadIM(p *parser) bool {
                        p.setOriginalIM()
                        p.im = textIM
                        return true
+               case "head":
+                       // Ignore the token.
+                       return true
                default:
                        implied = true
                }
index cb1559169ee4978e734fa06330700264cddea9a8..4a088c74b12eec31ad0c18c126a072ce5c892d83 100644 (file)
@@ -152,7 +152,7 @@ func TestParser(t *testing.T) {
                {"doctype01.dat", -1},
                {"tests1.dat", -1},
                {"tests2.dat", -1},
-               {"tests3.dat", 12},
+               {"tests3.dat", 20},
        }
        for _, tf := range testFiles {
                f, err := os.Open("testdata/webkit/" + tf.filename)