Subject: | Problem with </td> and </th> |
Date: | Sun, 1 Aug 2010 12:37:45 -0700 |
To: | bug-HTML-Tree [...] rt.cpan.org |
From: | Father Chrysostomos <sprout [...] cpan.org> |
All web browser I’ve tried this with ignore invalid </td> and </th> tags inside a table. HTML::TreeBuilder searches all the way up the hierarchy till it finds an element to close, even if it means that </td> will close a table. This affects code like this (albeit invalid):
<table><tr><td>
<table><tr><td></th></tr></table>
</table>
Changing this part of sub end
} else {
# the call came from Parser -- just ignore origtext
@stop = ();
}
to
} else {
# the call came from Parser -- just ignore origtext
@stop = $tag =~ /^t[hd]\z/ ? 'table' : ();
}
fixes the problem.