Skip to content

Namespace Sensitivity; Fragment leading to IndexError #239

Closed
@gsnedders

Description

@gsnedders
import html5lib

html5lib.parseFragment('<math><tr><td><mo><tr>',
                       container="td")

This causes:

Traceback (most recent call last):
  File "foo.py", line 5, in <module>
    treebuilder="dom")
  File "/Users/gsnedders/Documents/my-projects/html5lib/html5lib-python/html5lib/html5parser.py", line 36, in parseFragment
    return p.parseFragment(doc, container=container, encoding=encoding)
  File "/Users/gsnedders/Documents/my-projects/html5lib/html5lib-python/html5lib/html5parser.py", line 253, in parseFragment
    self._parse(stream, True, container=container, encoding=encoding)
  File "/Users/gsnedders/Documents/my-projects/html5lib/html5lib-python/html5lib/html5parser.py", line 94, in _parse
    self.mainLoop()
  File "/Users/gsnedders/Documents/my-projects/html5lib/html5lib-python/html5lib/html5parser.py", line 199, in mainLoop
    new_token = phase.processStartTag(new_token)
  File "/Users/gsnedders/Documents/my-projects/html5lib/html5lib-python/html5lib/html5parser.py", line 480, in processStartTag
    return self.startTagHandler[token["name"]](token)
  File "/Users/gsnedders/Documents/my-projects/html5lib/html5lib-python/html5lib/html5parser.py", line 2175, in startTagTableOther
    self.closeCell()
  File "/Users/gsnedders/Documents/my-projects/html5lib/html5lib-python/html5lib/html5parser.py", line 2161, in closeCell
    self.endTagTableCell(impliedTagToken("td"))
  File "/Users/gsnedders/Documents/my-projects/html5lib/html5lib-python/html5lib/html5parser.py", line 2197, in endTagTableCell
    self.tree.clearActiveFormattingElements()
  File "/Users/gsnedders/Documents/my-projects/html5lib/html5lib-python/html5lib/treebuilders/_base.py", line 228, in clearActiveFormattingElements
    entry = self.activeFormattingElements.pop()
IndexError: pop from empty list

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions