mirror of
https://github.com/golang/net.git
synced 2026-03-31 10:27:08 +09:00
html: fix wrong comparison in foster parenting algorithm
Fixes golang/go#23071 Change-Id: I383e13bfd87e32ffb775dff54c46b66b090e5017 Reviewed-on: https://go-review.googlesource.com/131475 Run-TryBot: Kunpei Sakai <namusyaka@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Nigel Tao <nigeltao@golang.org>
This commit is contained in:
@@ -255,7 +255,7 @@ func (p *parser) fosterParent(n *Node) {
|
||||
}
|
||||
}
|
||||
|
||||
if template != nil && (table == nil || j < i) {
|
||||
if template != nil && (table == nil || j > i) {
|
||||
template.AppendChild(n)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -329,6 +329,7 @@ var renderTestBlacklist = map[string]bool{
|
||||
`<a href="blah">aba<table><a href="foo">br<tr><td></td></tr>x</table>aoe`: true,
|
||||
`<a><table><a></table><p><a><div><a>`: true,
|
||||
`<a><table><td><a><table></table><a></tr><a></table><a>`: true,
|
||||
`<template><a><table><a>`: true,
|
||||
// A similar reparenting situation involving <nobr>:
|
||||
`<!DOCTYPE html><body><b><nobr>1<table><nobr></b><i><nobr>2<nobr></i>3`: true,
|
||||
// A <plaintext> element is reparented, putting it before a table.
|
||||
|
||||
27
html/testdata/webkit/template.dat
vendored
27
html/testdata/webkit/template.dat
vendored
@@ -1130,6 +1130,20 @@
|
||||
| <select>
|
||||
| <body>
|
||||
|
||||
#data
|
||||
<template><template><table>Foo
|
||||
#errors
|
||||
#document
|
||||
| <html>
|
||||
| <head>
|
||||
| <template>
|
||||
| content
|
||||
| <template>
|
||||
| content
|
||||
| "Foo"
|
||||
| <table>
|
||||
| <body>
|
||||
|
||||
#data
|
||||
<template><template><frame>
|
||||
#errors
|
||||
@@ -1297,3 +1311,16 @@
|
||||
| content
|
||||
| "Foo"
|
||||
| <body>
|
||||
|
||||
#data
|
||||
<template><a><table><a>
|
||||
#errors
|
||||
#document
|
||||
| <html>
|
||||
| <head>
|
||||
| <template>
|
||||
| content
|
||||
| <a>
|
||||
| <a>
|
||||
| <table>
|
||||
| <body>
|
||||
|
||||
Reference in New Issue
Block a user