mirror of https://github.com/golang/go.git
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
This commit is contained in:
parent
f597fa67c1
commit
c5038c8593
|
|
@ -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>"
|
||||
|
|
|
|||
Loading…
Reference in New Issue