1
0
mirror of https://github.com/golang/go synced 2024-11-20 04:44:40 -07:00

html: parse <link> elements in <head>

Pass tests1.dat, test 83:
<title><meta></title><link><title><meta></title>

| <html>
|   <head>
|     <title>
|       "<meta>"
|     <link>
|     <title>
|       "<meta>"
|   <body>

Also pass test 84:
<style><!--</style><meta><script>--><link></script>

R=nigeltao
CC=golang-dev
https://golang.org/cl/5331061
This commit is contained in:
Andrew Balholm 2011-11-03 17:12:13 +11:00 committed by Nigel Tao
parent 1c530d5d78
commit 77aabbf217
2 changed files with 5 additions and 3 deletions

View File

@ -455,8 +455,10 @@ func inHeadIM(p *parser) (insertionMode, bool) {
implied = true
case StartTagToken:
switch p.tok.Data {
case "meta":
// TODO.
case "base", "basefont", "bgsound", "command", "link", "meta":
p.addElement(p.tok.Data, p.tok.Attr)
p.oe.pop()
p.acknowledgeSelfClosingTag()
case "script", "title", "noscript", "noframes", "style":
p.addElement(p.tok.Data, p.tok.Attr)
p.setOriginalIM(inHeadIM)

View File

@ -133,7 +133,7 @@ func TestParser(t *testing.T) {
rc := make(chan io.Reader)
go readDat(filename, rc)
// TODO(nigeltao): Process all test cases, not just a subset.
for i := 0; i < 83; i++ {
for i := 0; i < 85; i++ {
// Parse the #data section.
b, err := ioutil.ReadAll(<-rc)
if err != nil {