diff options
| author | Nigel Tao <nigeltao@golang.org> | 2012-01-11 10:15:40 +1100 |
|---|---|---|
| committer | Nigel Tao <nigeltao@golang.org> | 2012-01-11 10:15:40 +1100 |
| commit | aa033c20b356b608e2fcc51e284cf711f952309b (patch) | |
| tree | e7416d5b4c5993e1626f742851cc9ace192fa5d4 /src/pkg/html/parse.go | |
| parent | dcdc309c7cec0785cd83ddeb752ccebc29a1f83d (diff) | |
| download | go-aa033c20b356b608e2fcc51e284cf711f952309b.tar.xz | |
html: propagate foreign namespaces only when adding foreign content.
Pass tests10.dat, test 31:
<div><svg><path><foreignObject><p></div>a
| <html>
| <head>
| <body>
| <div>
| <svg svg>
| <svg path>
| <svg foreignObject>
| <p>
| "a"
Also pass test 32:
<!DOCTYPE html><svg><desc><div><svg><ul>a
R=andybalholm
CC=golang-dev
https://golang.org/cl/5527064
Diffstat (limited to 'src/pkg/html/parse.go')
| -rw-r--r-- | src/pkg/html/parse.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/pkg/html/parse.go b/src/pkg/html/parse.go index 7077612e7a..43c04727ab 100644 --- a/src/pkg/html/parse.go +++ b/src/pkg/html/parse.go @@ -243,10 +243,9 @@ func (p *parser) addText(text string) { // addElement calls addChild with an element node. func (p *parser) addElement(tag string, attr []Attribute) { p.addChild(&Node{ - Type: ElementNode, - Data: tag, - Namespace: p.top().Namespace, - Attr: attr, + Type: ElementNode, + Data: tag, + Attr: attr, }) } @@ -1736,7 +1735,9 @@ func parseForeignContent(p *parser) bool { panic("html: bad parser state: unexpected namespace") } adjustForeignAttributes(p.tok.Attr) + namespace := p.top().Namespace p.addElement(p.tok.Data, p.tok.Attr) + p.top().Namespace = namespace case EndTagToken: for i := len(p.oe) - 1; i >= 0; i-- { if p.oe[i].Namespace == "" { |
