Skip to content

Commit

Permalink
Feedback updates.
Browse files Browse the repository at this point in the history
Co-authored-by: David Herrera <[email protected]>
Co-authored-by: Jon Surrell <[email protected]>
  • Loading branch information
3 people committed Jan 12, 2024
1 parent f3fe034 commit 8793d47
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions src/wp-includes/html-api/class-wp-html-tag-processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -249,31 +249,31 @@
*
* ## Tokens and finer-grained processing.
*
* It's also possible to scan through every lexical token in
* the HTML document using the `next_token()` function. This
* It's possible to scan through every lexical token in the
* HTML document using the `next_token()` function. This
* alternative form takes no argument and provides no built-in
* query syntax.
*
* Example:
*
* $title = '(untitled)';
* $text_content = '';
* $title = '(untitled)';
* $text = '';
* while ( $processor->next_token() ) {
* switch ( $processor->get_token_name() ) {
* case '#text':
* $text .= $processor->get_node_text();
* $text .= $processor->get_modifiable_text();
* break;
*
* case 'BR':
* $text .= "\n";
* break;
*
* case 'TITLE':
* $title = $processor->get_node_text();
* $title = $processor->get_modifiable_text();
* break;
* }
* }
* return trim( "# {$title}\n\n{$text_content}\n" );
* return trim( "# {$title}\n\n{$text}" );
*
* ### Tokens and _modifiable text_.
*
Expand Down Expand Up @@ -301,9 +301,9 @@
* style of including Javascript inside of HTML comments to avoid accidentally
* closing the SCRIPT from inside a Javascript string. E.g. `console.log( '</script>' )`.
* - `TITLE` and `TEXTAREA` whose contents are treated as plaintext and then any
* character references are decoded. E.g. "1 &amp;lt; 2 < 3" becomes "1 < 2 < 3".
* character references are decoded. E.g. `1 &lt; 2 < 3` becomes `1 < 2 < 3`.
* - `IFRAME`, `NOSCRIPT`, `NOEMBED`, `NOFRAME`, `STYLE` whose contents are treated as
* raw plaintext and left as-is. E.g. "1 &amp;lt; 2 < 3" remains "1 &amp;lt; 2 < 3".
* raw plaintext and left as-is. E.g. `1 &lt; 2 < 3` remains `1 &lt; 2 < 3`.
*
* #### Other tokens with modifiable text.
*
Expand Down Expand Up @@ -909,9 +909,14 @@ public function next_token() {

$tag_name = $this->get_tag();
if (
// Skips SCRIPT data.
'SCRIPT' !== $tag_name &&

// Skips RCDATA data.
'TEXTAREA' !== $tag_name &&
'TITLE' !== $tag_name &&

// Skips RAWTEXT data.
'IFRAME' !== $tag_name &&
'NOEMBED' !== $tag_name &&
'NOFRAMES' !== $tag_name &&
Expand Down

0 comments on commit 8793d47

Please sign in to comment.