Skip to content

Commit 3ab66b1

Browse files
committed
Fix: convert empty attribute values received from html.parser into empty-string values that xml.etree.ElementPath can use during attribute search
1 parent 8e5ccbf commit 3ab66b1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

htmlement.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ def _handle_starttag(self, tag, attrs, self_closing=False):
330330
# Add tag element to tree if we have no filter or that the filter matches
331331
if enabled or self._search(tag, attrs):
332332
# Convert attrs to dictionary
333-
attrs = dict(attrs) if attrs else {}
333+
attrs = {k: v or str() for k, v in attrs}
334334
self._flush()
335335

336336
# Create the new element

0 commit comments

Comments
 (0)