Skip to content

Commit

Permalink
Better tag finding
Browse files Browse the repository at this point in the history
  • Loading branch information
sirreal committed Dec 19, 2023
1 parent aec9690 commit d43ce28
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/phpunit/tests/html-api/wpHtmlProcessorHtml5lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,10 @@ public static function parse_html5_dat_testfile( $filename ) {
if ( '|' === $line[0] ) {
$candidate = substr( $line, 2 );
$trimmed = trim( $candidate );
// We ignore `<!` starters to skip `<!--` (comment opener) and `<!DOCTYPE`.
if ( '<' === $trimmed[0] && '<!' !== substr( $trimmed, 0, 2 ) ) {
// Only take lines that look like tags
// At least 3 chars (< + tag + >)
// Tag must start with ascii alphabetic
if ( strlen( $trimmed > 2 ) && '<' === $trimmed[0] && ctype_alpha( $trimmed[1] ) ) {
$test_dom .= $candidate;
}
}
Expand Down

0 comments on commit d43ce28

Please sign in to comment.