Commit 46308d7d authored by Andrew Balholm's avatar Andrew Balholm Committed by Nigel Tao

html: move <link> element from after <head> into <head>

Pass tests1.dat, test 85:
<head><meta></head><link>

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

R=nigeltao
CC=golang-dev
https://golang.org/cl/5297079
parent a7f1141d
...@@ -427,6 +427,7 @@ func beforeHeadIM(p *parser) (insertionMode, bool) { ...@@ -427,6 +427,7 @@ func beforeHeadIM(p *parser) (insertionMode, bool) {
} }
if add || implied { if add || implied {
p.addElement("head", attr) p.addElement("head", attr)
p.head = p.top()
} }
return inHeadIM, !implied return inHeadIM, !implied
} }
...@@ -511,7 +512,9 @@ func afterHeadIM(p *parser) (insertionMode, bool) { ...@@ -511,7 +512,9 @@ func afterHeadIM(p *parser) (insertionMode, bool) {
case "frameset": case "frameset":
// TODO. // TODO.
case "base", "basefont", "bgsound", "link", "meta", "noframes", "script", "style", "title": 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": case "head":
// TODO. // TODO.
default: default:
......
...@@ -133,7 +133,7 @@ func TestParser(t *testing.T) { ...@@ -133,7 +133,7 @@ func TestParser(t *testing.T) {
rc := make(chan io.Reader) rc := make(chan io.Reader)
go readDat(filename, rc) go readDat(filename, rc)
// TODO(nigeltao): Process all test cases, not just a subset. // 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. // Parse the #data section.
b, err := ioutil.ReadAll(<-rc) b, err := ioutil.ReadAll(<-rc)
if err != nil { if err != nil {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment