From: Nigel Tao Date: Mon, 19 Dec 2011 01:20:00 +0000 (+1100) Subject: html: handle text nodes in foreign content. X-Git-Tag: weekly.2011-12-22~133 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=18e844147693b0346dc813fbc05a8beb7a210f2f;p=gostls13.git html: handle text nodes in foreign content. Passes tests10.dat, test 6: foo
| | | | | | | "foo" | Also pass tests through test 12:
foobar

baz

R=andybalholm CC=golang-dev https://golang.org/cl/5495061 --- diff --git a/src/pkg/html/parse.go b/src/pkg/html/parse.go index 104adc1b7b..a69262115c 100644 --- a/src/pkg/html/parse.go +++ b/src/pkg/html/parse.go @@ -1585,6 +1585,17 @@ func afterAfterFramesetIM(p *parser) bool { // Section 12.2.5.5. func inForeignContentIM(p *parser) bool { switch p.tok.Type { + case TextToken: + // TODO: HTML integration points. + if p.top().Namespace == "" { + inBodyIM(p) + p.resetInsertionMode() + return true + } + if p.framesetOK { + p.framesetOK = strings.TrimLeft(p.tok.Data, whitespace) == "" + } + p.addText(p.tok.Data) case CommentToken: p.addChild(&Node{ Type: CommentNode, diff --git a/src/pkg/html/parse_test.go b/src/pkg/html/parse_test.go index f501915759..b938ca7185 100644 --- a/src/pkg/html/parse_test.go +++ b/src/pkg/html/parse_test.go @@ -173,7 +173,7 @@ func TestParser(t *testing.T) { {"tests4.dat", -1}, {"tests5.dat", -1}, {"tests6.dat", 36}, - {"tests10.dat", 6}, + {"tests10.dat", 13}, } for _, tf := range testFiles { f, err := os.Open("testdata/webkit/" + tf.filename)