Skip to content

Commit

Permalink
Restore ability to provide a tree builder name as string (#559)
Browse files Browse the repository at this point in the history
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
  • Loading branch information
theRealProHacker and ambv committed Mar 1, 2023
1 parent 1b39377 commit c64a111
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions html5lib/html5parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ def __init__(self, tree=None, strict=False, namespaceHTMLElements=True, debug=Fa

if tree is None:
tree = treebuilders.getTreeBuilder("etree")
elif isinstance(tree, str):
tree = treebuilders.getTreeBuilder(tree)

self.tree = tree(namespaceHTMLElements)
self.errors = []

Expand Down

0 comments on commit c64a111

Please sign in to comment.