Skip to content

Remove the isstring hack in lxml treewalker #118

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

Merged
merged 1 commit into from
Nov 2, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions html5lib/treewalkers/lxmletree.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,6 @@ def __init__(self, fragment_root, obj):
self.tail = ensure_str(self.obj.tail)
else:
self.tail = None
self.isstring = isinstance(obj, str) or isinstance(obj, bytes)
# Support for bytes here is Py2
if self.isstring:
self.obj = ensure_str(self.obj)

def __getattr__(self, name):
return getattr(self.obj, name)
Expand Down Expand Up @@ -143,7 +139,7 @@ def getNodeDetails(self, node):
elif isinstance(node, Doctype):
return _base.DOCTYPE, node.name, node.public_id, node.system_id

elif isinstance(node, FragmentWrapper) and node.isstring:
elif isinstance(node, FragmentWrapper) and not hasattr(node, "tag"):
return _base.TEXT, node.obj

elif node.tag == etree.Comment:
Expand Down