// fosterParent adds a child node according to the foster parenting rules.
// Section 11.2.5.3, "foster parenting".
func (p *parser) fosterParent(n *Node) {
+ p.fosterParenting = false
var table, parent *Node
var i int
for i = len(p.oe) - 1; i >= 0; i-- {
case EndTagToken:
switch p.tok.Data {
case "td", "th":
- // TODO.
+ if !p.popUntil(tableScopeStopTags, p.tok.Data) {
+ // Ignore the token.
+ return inCellIM, true
+ }
+ p.clearActiveFormattingElements()
+ return inRowIM, true
case "body", "caption", "col", "colgroup", "html":
// TODO.
case "table", "tbody", "tfoot", "thead", "tr":
rc := make(chan io.Reader)
go readDat(filename, rc)
// TODO(nigeltao): Process all test cases, not just a subset.
- for i := 0; i < 77; i++ {
+ for i := 0; i < 78; i++ {
// Parse the #data section.
b, err := ioutil.ReadAll(<-rc)
if err != nil {
continue
}
// Check that rendering and re-parsing results in an identical tree.
- if filename == "tests1.dat" && i == 30 {
- // Test 30 in tests1.dat is such messed-up markup that a correct parse
+ if filename == "tests1.dat" && (i == 30 || i == 77) {
+ // Some tests in tests1.dat have such messed-up markup that a correct parse
// results in a non-conforming tree (one <a> element nested inside another).
// Therefore when it is rendered and re-parsed, it isn't the same.
// So we skip rendering on that test.