]> Cypherpunks repositories - gostls13.git/commitdiff
html: parse <link> elements in <head>
authorAndrew Balholm <andybalholm@gmail.com>
Thu, 3 Nov 2011 06:12:13 +0000 (17:12 +1100)
committerNigel Tao <nigeltao@golang.org>
Thu, 3 Nov 2011 06:12:13 +0000 (17:12 +1100)
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

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

index 4a21be925a6425c242212911ecc259772f3f0135..38f8ba481aa35b60d74b8a9875988b9b1f276225 100644 (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)
index 65fc8edaed59086a27d7fd57c9d8369612b3bd67..3194a3fa4784a64afcfeee1391598b5c17d7f4c8 100644 (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 {