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 {