aboutsummaryrefslogtreecommitdiff
path: root/src/pkg
diff options
context:
space:
mode:
authorAndrew Balholm <andybalholm@gmail.com>2011-11-22 12:08:22 +1100
committerNigel Tao <nigeltao@golang.org>2011-11-22 12:08:22 +1100
commit95e60acb97f26f56b459fc0ef75f63ccb502c9ed (patch)
tree2b59e19c20dd4142bd8ae739990ac90f5a64f5fb /src/pkg
parent750de28d6ceb5c42637b08fb87f2de2f826ed0eb (diff)
downloadgo-95e60acb97f26f56b459fc0ef75f63ccb502c9ed.tar.xz
html: copy attributes from extra <html> tags to root element
Pass tests2.dat, test 50: <!DOCTYPE html><html><body><html id=x> | <!DOCTYPE html> | <html> | id="x" | <head> | <body> Also pass tests through test 56: <!DOCTYPE html>X<p/x/y/z> R=nigeltao CC=golang-dev https://golang.org/cl/5432045
Diffstat (limited to 'src/pkg')
-rw-r--r--src/pkg/html/parse.go4
-rw-r--r--src/pkg/html/parse_test.go2
2 files changed, 5 insertions, 1 deletions
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 {