]> Cypherpunks repositories - gostls13.git/commitdiff
html: move <link> element from after <head> into <head>
authorAndrew Balholm <andybalholm@gmail.com>
Thu, 3 Nov 2011 22:29:06 +0000 (09:29 +1100)
committerNigel Tao <nigeltao@golang.org>
Thu, 3 Nov 2011 22:29:06 +0000 (09:29 +1100)
Pass tests1.dat, test 85:
<head><meta></head><link>

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

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

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

index 38f8ba481aa35b60d74b8a9875988b9b1f276225..0204b7c281cee8c0cab7b601969508b8e66bd863 100644 (file)
@@ -427,6 +427,7 @@ func beforeHeadIM(p *parser) (insertionMode, bool) {
        }
        if add || implied {
                p.addElement("head", attr)
+               p.head = p.top()
        }
        return inHeadIM, !implied
 }
@@ -511,7 +512,9 @@ func afterHeadIM(p *parser) (insertionMode, bool) {
                case "frameset":
                        // TODO.
                case "base", "basefont", "bgsound", "link", "meta", "noframes", "script", "style", "title":
-                       // TODO.
+                       p.oe = append(p.oe, p.head)
+                       defer p.oe.pop()
+                       return useTheRulesFor(p, afterHeadIM, inHeadIM)
                case "head":
                        // TODO.
                default:
index 3194a3fa4784a64afcfeee1391598b5c17d7f4c8..8dc00ba484c4d849f2647ceaeb5015acbfe406f2 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 < 85; i++ {
+               for i := 0; i < 86; i++ {
                        // Parse the #data section.
                        b, err := ioutil.ReadAll(<-rc)
                        if err != nil {