Skip to content

Commit 069b7b3

Browse files
committed
Merge pull request #30 from tweekmonster/tagname-exception
Check for `tagName` attr before checking script tag
2 parents 8861dbe + b15d344 commit 069b7b3

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

microdata.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ def _text(e):
209209
chunks = []
210210
if e.nodeType == e.TEXT_NODE:
211211
chunks.append(e.data)
212-
elif e.tagName == 'script':
212+
elif hasattr(e, 'tagName') and e.tagName == 'script':
213213
return ''
214214
for child in e.childNodes:
215215
chunks.append(_text(child))

test-data/example.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<span itemprop="streetAddress">
1616
20341 Whitworth Institute
1717
405 N. Whitworth
18+
<!-- Comment Node -->
1819
<script>
1920
// Unrelated text
2021
</script>

0 commit comments

Comments
 (0)