From: Andrew Balholm Date: Tue, 22 Nov 2011 01:08:22 +0000 (+1100) Subject: html: copy attributes from extra tags to root element X-Git-Tag: weekly.2011-12-01~82 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=95e60acb97f26f56b459fc0ef75f63ccb502c9ed;p=gostls13.git html: copy attributes from extra tags to root element Pass tests2.dat, test 50: | | | id="x" | | Also pass tests through test 56: X

R=nigeltao CC=golang-dev https://golang.org/cl/5432045 --- diff --git a/src/pkg/html/parse.go b/src/pkg/html/parse.go index b74831b34e..36204895b9 100644 --- a/src/pkg/html/parse.go +++ b/src/pkg/html/parse.go @@ -457,6 +457,8 @@ func inHeadIM(p *parser) bool { implied = true case StartTagToken: switch p.tok.Data { + case "html": + return inBodyIM(p) case "base", "basefont", "bgsound", "command", "link", "meta": p.addElement(p.tok.Data, p.tok.Attr) p.oe.pop() @@ -581,6 +583,8 @@ func inBodyIM(p *parser) bool { p.framesetOK = false case StartTagToken: switch p.tok.Data { + case "html": + copyAttributes(p.oe[0], p.tok) case "address", "article", "aside", "blockquote", "center", "details", "dir", "div", "dl", "fieldset", "figcaption", "figure", "footer", "header", "hgroup", "menu", "nav", "ol", "p", "section", "summary", "ul": p.popUntil(buttonScopeStopTags, "p") p.addElement(p.tok.Data, p.tok.Attr) diff --git a/src/pkg/html/parse_test.go b/src/pkg/html/parse_test.go index 808300a289..3566f9f941 100644 --- a/src/pkg/html/parse_test.go +++ b/src/pkg/html/parse_test.go @@ -134,7 +134,7 @@ func TestParser(t *testing.T) { }{ // TODO(nigeltao): Process all the test cases from all the .dat files. {"tests1.dat", -1}, - {"tests2.dat", 50}, + {"tests2.dat", 57}, {"tests3.dat", 0}, } for _, tf := range testFiles {