Skip to content

Commit

Permalink
Remove the isstring hack in lxml treewalker.
Browse files Browse the repository at this point in the history
This fixes html5lib#115 as a result, as we're no longer type-sniffing strings.
  • Loading branch information
gsnedders committed Nov 1, 2013
1 parent f130676 commit e269a2f
Showing 1 changed file with 1 addition and 5 deletions.
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

0 comments on commit e269a2f

Please sign in to comment.