Skip to content

Namespace Sensitivity; Fragment leading to IndexError #239

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
gsnedders opened this issue May 3, 2016 · 1 comment
Closed

Namespace Sensitivity; Fragment leading to IndexError #239

gsnedders opened this issue May 3, 2016 · 1 comment

Comments

@gsnedders
Copy link
Member

gsnedders commented May 3, 2016

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
@gsnedders gsnedders modified the milestone: 0.99999999 May 8, 2016
@gsnedders gsnedders changed the title DOM tree builder leading to IndexError Fragment leading to IndexError Jun 2, 2016
@gsnedders gsnedders changed the title Fragment leading to IndexError Namespace Sensitivity; Fragment leading to IndexError Jun 2, 2016
@gsnedders
Copy link
Member Author

Ah, this is the classic namespace sensitivity bug. Ergh. Solving this with namespaceHTMLElements will be fun.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant