Skip to content

Commit c3f1a81

Browse files
committed
Remove normalization function from tests
1 parent 640f458 commit c3f1a81

1 file changed

Lines changed: 0 additions & 58 deletions

File tree

tests/phpunit/tests/html-api/wpHtmlProcessorFragmentParsing.php

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -79,62 +79,4 @@ public static function data_invalid_fragment_contexts() {
7979
'XMP' => array( '<xmp>' ),
8080
);
8181
}
82-
83-
/**
84-
* Produces normalized HTML output given a processor as input, which has not
85-
* yet started to proceed through its document.
86-
*
87-
* This can be used with a full or a fragment parser.
88-
*
89-
* @param WP_HTML_Processor $processor HTML Processor in READY state at the beginning of its input.
90-
* @return string|null Normalized HTML from input processor.
91-
*/
92-
private static function normalize_html( WP_HTML_Processor $processor ): ?string {
93-
$html = '';
94-
95-
while ( $processor->next_token() ) {
96-
$token_name = $processor->get_token_name();
97-
$token_type = $processor->get_token_type();
98-
$is_closer = $processor->is_tag_closer();
99-
100-
switch ( $token_type ) {
101-
case '#text':
102-
$html .= $processor->get_modifiable_text();
103-
break;
104-
105-
case '#tag':
106-
if ( $is_closer ) {
107-
$html .= "</{$token_name}>";
108-
} else {
109-
$names = $processor->get_attribute_names_with_prefix( '' );
110-
if ( ! isset( $names ) ) {
111-
$html .= "<{$token_name}>";
112-
} else {
113-
$html .= "<{$token_name}";
114-
foreach ( $names as $name ) {
115-
$value = $processor->get_attribute( $name );
116-
if ( true === $value ) {
117-
$html .= " {$name}";
118-
} else {
119-
$value = strtr( $value, '"', '&quot;' );
120-
$html .= " {$name}=\"{$value}\"";
121-
}
122-
}
123-
}
124-
125-
$text = $processor->get_modifiable_text();
126-
if ( '' !== $text ) {
127-
$html .= "{$text}</{$token_name}>";
128-
}
129-
}
130-
break;
131-
}
132-
}
133-
134-
if ( null !== $processor->get_last_error() ) {
135-
return null;
136-
}
137-
138-
return $html;
139-
}
14082
}

0 commit comments

Comments
 (0)