Skip to content

Commit 4ba1728

Browse files
committed
Fix an error when a text node is parsed as HTML
1 parent b610ada commit 4ba1728

1 file changed

Lines changed: 14 additions & 14 deletions

File tree

src/ParseHTML.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,20 @@ public static function parseURLsDOMNode( \DOMNode $node ): \Iterator {
1515
if ( $child instanceof \DOMElement ) {
1616
// phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
1717
$tag_name = strtolower( $child->tagName );
18-
}
19-
switch ( $tag_name ) {
20-
case 'a':
21-
case 'link':
22-
yield $child->getAttribute( 'href' );
23-
break;
24-
case 'img':
25-
case 'script':
26-
case 'source':
27-
yield $child->getAttribute( 'src' );
28-
break;
29-
}
30-
foreach ( self::parseURLsDOMNode( $child ) as $url ) {
31-
yield $url;
18+
switch ( $tag_name ) {
19+
case 'a':
20+
case 'link':
21+
yield $child->getAttribute( 'href' );
22+
break;
23+
case 'img':
24+
case 'script':
25+
case 'source':
26+
yield $child->getAttribute( 'src' );
27+
break;
28+
}
29+
foreach ( self::parseURLsDOMNode( $child ) as $url ) {
30+
yield $url;
31+
}
3232
}
3333
}
3434
}

0 commit comments

Comments
 (0)