1
0
mirror of https://github.com/golang/go synced 2024-11-12 06:20:22 -07:00

html: ignore <head> tags in <head> element

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
This commit is contained in:
Andrew Balholm 2011-11-27 14:41:08 +11:00 committed by Nigel Tao
parent e9025df7ad
commit 557ba72e69
2 changed files with 4 additions and 1 deletions

View 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
}

View 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)