aboutsummaryrefslogtreecommitdiff
path: root/src/pkg
diff options
context:
space:
mode:
authorAndrew Balholm <andybalholm@gmail.com>2012-08-10 09:34:10 +1000
committerNigel Tao <nigeltao@golang.org>2012-08-10 09:34:10 +1000
commitc5038c85933a69a1ddeae812d601eb11e71cdc58 (patch)
tree09fbb54ee050ff94984564a0cf7b6043442db9be /src/pkg
parentf597fa67c16dbce225ceb8482acd92a5c474fc19 (diff)
downloadgo-c5038c85933a69a1ddeae812d601eb11e71cdc58.tar.xz
exp/html: ignore self-closing flag except in SVG and MathML
In HTML content, having a self-closing tag is a parse error unless the tag would be self-closing anyway (like <img>). The only place a self-closing tag actually makes a difference is in XML-based foreign content. Pass 1 additional test. R=nigeltao CC=golang-dev https://golang.org/cl/6450109
Diffstat (limited to 'src/pkg')
-rw-r--r--src/pkg/exp/html/parse.go6
-rw-r--r--src/pkg/exp/html/testlogs/webkit01.dat.log2
2 files changed, 6 insertions, 2 deletions
diff --git a/src/pkg/exp/html/parse.go b/src/pkg/exp/html/parse.go
index 0ae660c83d..1c40cd30a1 100644
--- a/src/pkg/exp/html/parse.go
+++ b/src/pkg/exp/html/parse.go
@@ -999,6 +999,10 @@ func inBodyIM(p *parser) bool {
adjustForeignAttributes(p.tok.Attr)
p.addElement()
p.top().Namespace = p.tok.Data
+ if p.hasSelfClosingToken {
+ p.oe.pop()
+ p.acknowledgeSelfClosingTag()
+ }
return true
case a.Caption, a.Col, a.Colgroup, a.Frame, a.Head, a.Tbody, a.Td, a.Tfoot, a.Th, a.Thead, a.Tr:
// Ignore the token.
@@ -2011,8 +2015,8 @@ func (p *parser) parseCurrentToken() {
}
if p.hasSelfClosingToken {
+ // This is a parse error, but ignore it.
p.hasSelfClosingToken = false
- p.parseImpliedToken(EndTagToken, p.tok.DataAtom, p.tok.Data)
}
}
diff --git a/src/pkg/exp/html/testlogs/webkit01.dat.log b/src/pkg/exp/html/testlogs/webkit01.dat.log
index 635cc8e180..9fd91dfb99 100644
--- a/src/pkg/exp/html/testlogs/webkit01.dat.log
+++ b/src/pkg/exp/html/testlogs/webkit01.dat.log
@@ -40,7 +40,7 @@ PASS "<svg><title><div>"
PASS "<svg><title><rect><div>"
PASS "<svg><title><svg><div>"
PASS "<img <=\"\" FAIL>"
-FAIL "<ul><li><div id='foo'/>A</li><li>B<div>C</div></li></ul>"
+PASS "<ul><li><div id='foo'/>A</li><li>B<div>C</div></li></ul>"
PASS "<svg><em><desc></em>"
PASS "<table><tr><td><svg><desc><td></desc><circle>"
PASS "<svg><tfoot></mi><td>"