Showing content from https://www.mail-archive.com/html5lib-discuss@googlegroups.com/msg00284/html5-r2732.patch below:
Index: src/html5lib/treebuilders/_base.py =================================================================== --- src/html5lib/treebuilders/_base.py (revision 1265) +++ src/html5lib/treebuilders/_base.py (working copy) @@ -291,18 +291,17 @@ for elm in self.openElements[::-1]: if elm.name == "table": lastTable = elm + elif lastTable is not None: + fosterParent = elm break - if lastTable: - # XXX - we should really check that this parent is actually a - # node here - if lastTable.parent: - fosterParent = lastTable.parent - insertBefore = lastTable - else: - fosterParent = self.openElements[ - self.openElements.index(lastTable) - 1] else: + # TODO: assert fragment case fosterParent = self.openElements[0] + assert fosterParent.name == 'html' + + if lastTable and lastTable.parent is fosterParent: + insertBefore = lastTable + return fosterParent, insertBefore def generateImpliedEndTags(self, exclude=None):
RetroSearch is an open source project built by @garambo
| Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4