diff options
author | Frédéric Guillot <fred@miniflux.net> | 2019-02-28 21:22:58 -0800 |
---|---|---|
committer | Frédéric Guillot <fred@miniflux.net> | 2019-02-28 21:23:33 -0800 |
commit | 6764a420b0b135e55bcf885eb4bd2031bf5f7604 (patch) | |
tree | 1cad46f3d35441ce85282a515424caa7d2fff1f7 /vendor | |
parent | 45df254fe74ec42d426b00b1dcfb9a274bca08dd (diff) |
Make parser compatible with Go 1.12
See changes in strings.Map(): https://golang.org/doc/go1.12#strings
Diffstat (limited to 'vendor')
-rw-r--r-- | vendor/golang.org/x/net/html/node.go | 2 | ||||
-rw-r--r-- | vendor/golang.org/x/net/html/parse.go | 31 | ||||
-rw-r--r-- | vendor/modules.txt | 2 |
3 files changed, 24 insertions, 11 deletions
diff --git a/vendor/golang.org/x/net/html/node.go b/vendor/golang.org/x/net/html/node.go index 2c1cade..633ee15 100644 --- a/vendor/golang.org/x/net/html/node.go +++ b/vendor/golang.org/x/net/html/node.go @@ -177,7 +177,7 @@ func (s *nodeStack) index(n *Node) int { // contains returns whether a is within s. func (s *nodeStack) contains(a atom.Atom) bool { for _, n := range *s { - if n.DataAtom == a { + if n.DataAtom == a && n.Namespace == "" { return true } } diff --git a/vendor/golang.org/x/net/html/parse.go b/vendor/golang.org/x/net/html/parse.go index 64a5793..ca2cb58 100644 --- a/vendor/golang.org/x/net/html/parse.go +++ b/vendor/golang.org/x/net/html/parse.go @@ -439,9 +439,6 @@ func (p *parser) resetInsertionMode() { case a.Select: if !last { for ancestor, first := n, p.oe[0]; ancestor != first; { - if ancestor == first { - break - } ancestor = p.oe[p.oe.index(ancestor)-1] switch ancestor.DataAtom { case a.Template: @@ -1719,8 +1716,12 @@ func inSelectIM(p *parser) bool { } p.addElement() case a.Select: - p.tok.Type = EndTagToken - return false + if p.popUntil(selectScope, a.Select) { + p.resetInsertionMode() + } else { + // Ignore the token. + return true + } case a.Input, a.Keygen, a.Textarea: if p.elementInScope(selectScope, a.Select) { p.parseImpliedToken(EndTagToken, a.Select, a.Select.String()) @@ -1750,6 +1751,9 @@ func inSelectIM(p *parser) bool { case a.Select: if p.popUntil(selectScope, a.Select) { p.resetInsertionMode() + } else { + // Ignore the token. + return true } case a.Template: return inHeadIM(p) @@ -1775,13 +1779,22 @@ func inSelectInTableIM(p *parser) bool { case StartTagToken, EndTagToken: switch p.tok.DataAtom { case a.Caption, a.Table, a.Tbody, a.Tfoot, a.Thead, a.Tr, a.Td, a.Th: - if p.tok.Type == StartTagToken || p.elementInScope(tableScope, p.tok.DataAtom) { - p.parseImpliedToken(EndTagToken, a.Select, a.Select.String()) - return false - } else { + if p.tok.Type == EndTagToken && !p.elementInScope(tableScope, p.tok.DataAtom) { // Ignore the token. return true } + // This is like p.popUntil(selectScope, a.Select), but it also + // matches <math select>, not just <select>. Matching the MathML + // tag is arguably incorrect (conceptually), but it mimics what + // Chromium does. + for i := len(p.oe) - 1; i >= 0; i-- { + if n := p.oe[i]; n.DataAtom == a.Select { + p.oe = p.oe[:i] + break + } + } + p.resetInsertionMode() + return false } } return inSelectIM(p) diff --git a/vendor/modules.txt b/vendor/modules.txt index cce7a9e..f25c164 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -18,7 +18,7 @@ golang.org/x/crypto/acme/autocert golang.org/x/crypto/bcrypt golang.org/x/crypto/acme golang.org/x/crypto/blowfish -# golang.org/x/net v0.0.0-20181207154023-610586996380 +# golang.org/x/net v0.0.0-20190228165749-92fc7df08ae7 golang.org/x/net/html/charset golang.org/x/net/html golang.org/x/net/html/atom |