diff --git a/test/test_utils.py b/test/test_utils.py
index 44747efda6..12c9d68057 100644
--- a/test/test_utils.py
+++ b/test/test_utils.py
@@ -1787,6 +1787,9 @@ Line 1
GET_ELEMENT_BY_ATTRIBUTE_TEST_STRING = '''
@@ -1881,6 +1906,10 @@ Line 1
(self.GET_ELEMENT_BY_TAG_RES_INNERSPAN_TEXT, self.GET_ELEMENT_BY_TAG_RES_INNERSPAN_HTML))
self.assertRaises(compat_HTMLParseError, get_element_text_and_html_by_tag, 'article', html)
+ html = self.VOID_ELEMENT_TEST_STRING
+
+ self.assertEqual(get_element_text_and_html_by_tag('img', html), ('', '

'))
+
def test_iri_to_uri(self):
self.assertEqual(
iri_to_uri('https://www.google.com/search?q=foo&ie=utf-8&oe=utf-8&client=firefox-b'),
diff --git a/yt_dlp/utils/_utils.py b/yt_dlp/utils/_utils.py
index a5471da4df..8f9c76a640 100644
--- a/yt_dlp/utils/_utils.py
+++ b/yt_dlp/utils/_utils.py
@@ -167,6 +167,12 @@ JSON_LD_RE = r'(?is)