Skip to content

Commit 8793d47

Browse files
dmsnelldlh01sirreal
committed
Feedback updates.
Co-authored-by: David Herrera <mail@dlh01.info> Co-authored-by: Jon Surrell <sirreal@users.noreply.github.com>
1 parent f3fe034 commit 8793d47

1 file changed

Lines changed: 14 additions & 9 deletions

File tree

src/wp-includes/html-api/class-wp-html-tag-processor.php

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -249,31 +249,31 @@
249249
*
250250
* ## Tokens and finer-grained processing.
251251
*
252-
* It's also possible to scan through every lexical token in
253-
* the HTML document using the `next_token()` function. This
252+
* It's possible to scan through every lexical token in the
253+
* HTML document using the `next_token()` function. This
254254
* alternative form takes no argument and provides no built-in
255255
* query syntax.
256256
*
257257
* Example:
258258
*
259-
* $title = '(untitled)';
260-
* $text_content = '';
259+
* $title = '(untitled)';
260+
* $text = '';
261261
* while ( $processor->next_token() ) {
262262
* switch ( $processor->get_token_name() ) {
263263
* case '#text':
264-
* $text .= $processor->get_node_text();
264+
* $text .= $processor->get_modifiable_text();
265265
* break;
266266
*
267267
* case 'BR':
268268
* $text .= "\n";
269269
* break;
270270
*
271271
* case 'TITLE':
272-
* $title = $processor->get_node_text();
272+
* $title = $processor->get_modifiable_text();
273273
* break;
274274
* }
275275
* }
276-
* return trim( "# {$title}\n\n{$text_content}\n" );
276+
* return trim( "# {$title}\n\n{$text}" );
277277
*
278278
* ### Tokens and _modifiable text_.
279279
*
@@ -301,9 +301,9 @@
301301
* style of including Javascript inside of HTML comments to avoid accidentally
302302
* closing the SCRIPT from inside a Javascript string. E.g. `console.log( '</script>' )`.
303303
* - `TITLE` and `TEXTAREA` whose contents are treated as plaintext and then any
304-
* character references are decoded. E.g. "1 &amp;lt; 2 < 3" becomes "1 < 2 < 3".
304+
* character references are decoded. E.g. `1 &lt; 2 < 3` becomes `1 < 2 < 3`.
305305
* - `IFRAME`, `NOSCRIPT`, `NOEMBED`, `NOFRAME`, `STYLE` whose contents are treated as
306-
* raw plaintext and left as-is. E.g. "1 &amp;lt; 2 < 3" remains "1 &amp;lt; 2 < 3".
306+
* raw plaintext and left as-is. E.g. `1 &lt; 2 < 3` remains `1 &lt; 2 < 3`.
307307
*
308308
* #### Other tokens with modifiable text.
309309
*
@@ -909,9 +909,14 @@ public function next_token() {
909909

910910
$tag_name = $this->get_tag();
911911
if (
912+
// Skips SCRIPT data.
912913
'SCRIPT' !== $tag_name &&
914+
915+
// Skips RCDATA data.
913916
'TEXTAREA' !== $tag_name &&
914917
'TITLE' !== $tag_name &&
918+
919+
// Skips RAWTEXT data.
915920
'IFRAME' !== $tag_name &&
916921
'NOEMBED' !== $tag_name &&
917922
'NOFRAMES' !== $tag_name &&

0 commit comments

Comments
 (0)