Commit c5038c85 authored by Andrew Balholm's avatar Andrew Balholm Committed by Nigel Tao

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
parent f597fa67
......@@ -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)
}
}
......
......@@ -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>"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment