Skip to content

Commit 8b87248

Browse files
committed
Clean up escaping contents
1 parent bf9c616 commit 8b87248

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3845,9 +3845,6 @@ public function set_modifiable_text( string $plaintext_content ): bool {
38453845
) {
38463846
/*
38473847
* JavaScript can be safely escaped.
3848-
* Non-JavaScript script tags have unknown semantics.
3849-
*
3850-
* @todo consider applying to JSON and importmap script tags as well.
38513848
*/
38523849
if ( $this->is_javascript_script_tag() ) {
38533850
$plaintext_content = preg_replace_callback(
@@ -3869,14 +3866,16 @@ static function ( $matches ) {
38693866
);
38703867
} elseif ( $this->is_json_script_tag() ) {
38713868
/*
3872-
* To JSON escape JSON, the `<` character can be replaced
3873-
* everywhere.
3869+
* JSON can be safely escaped.
38743870
*/
38753871
$plaintext_content = strtr(
38763872
$plaintext_content,
38773873
array( '<' => '\\u003C' )
38783874
);
38793875
} else {
3876+
/*
3877+
* Other types of script tags cannot be escaped safely.
3878+
*/
38803879
return false;
38813880
}
38823881
}

0 commit comments

Comments
 (0)