Skip to content

Commit 83ff62f

Browse files
committed
Fix comments, typos, lints
1 parent 1872681 commit 83ff62f

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

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

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3811,14 +3811,14 @@ public function set_modifiable_text( string $plaintext_content ): bool {
38113811

38123812
switch ( $this->get_tag() ) {
38133813
case 'SCRIPT':
3814-
/*
3815-
* SCRIPT tag contents can be dangerous:
3814+
/**
3815+
* Identify risky script contents to escape when possible or reject otherwise:
38163816
*
38173817
* - "</script>" could close the SCRIPT element prematurely.
3818-
* - "<script>" could enter the “script data double escaped state” and preventing the
3818+
* - "<script>" could enter the “script data double escaped state” and prevent the
38193819
* SCRIPT element from closing as expected.
38203820
*
3821-
* Identify risky script contents to escape when possible or reject otherwise.
3821+
* @see WP_HTML_Tag_Processor::escape_javascript_script_contents()
38223822
*/
38233823
$needs_escaping =
38243824
false !== stripos( $plaintext_content, '</script' ) ||
@@ -3830,8 +3830,8 @@ public function set_modifiable_text( string $plaintext_content ): bool {
38303830
$plaintext_content = $this->escape_json_script_contents( $plaintext_content );
38313831
} else {
38323832
/*
3833-
* Other types of script tags cannot be escaped safely because the type
3834-
* of comment and escaping strategy are unknown.
3833+
* Other types of script tags cannot be escaped safely because there is
3834+
* no general escaping mechanism for arbitrary types of content.
38353835
*/
38363836
return false;
38373837
}
@@ -4095,7 +4095,7 @@ private function is_json_script_tag(): bool {
40954095
* `regex.test( '<script>' ) === true` in both the unescaped and
40964096
* escaped versions.
40974097
*
4098-
* JavaScript that is relies on behavior affected by this escaping must provide
4098+
* JavaScript that relies on behavior affected by this escaping must provide
40994099
* safe script contents in order to avoid this escaping. For example, a raw string
41004100
* may be split up to make its contents safe or avoided altogether:
41014101
*
@@ -4161,9 +4161,9 @@ static function ( $matches ) {
41614161
*
41624162
* JSON can be escaped simply by replacing "<" with its Unicode escape
41634163
* sequence "\u003C". "<" is not part of the JSON syntax and only appears
4164-
* in JSON strings, so it's always safe to escape. Furthermore, JSON only
4165-
* does not allow backslash escaping of "<", so there's no need to
4166-
* consider whether the "<" is escaped.
4164+
* in JSON strings, so it's always safe to escape. Furthermore, JSON does
4165+
* not allow backslash escaping of "<", so there's no need to consider
4166+
* whether the "<" is preceded by an escaping backslash.
41674167
*
41684168
* For more details, see {@see WP_HTML_Tag_Processor::escape_javascript_script_contents()}.
41694169
* @see https://www.json.org/json-en.html
@@ -4967,16 +4967,16 @@ public function get_doctype_info(): ?WP_HTML_Doctype_Info {
49674967
}
49684968

49694969
/*
4970-
# This is the original Graphviz source for the SCRIPT content
4971-
# parsinge behavior. It's used in the documention of
4970+
# This is the original Graphviz source for the SCRIPT tag
4971+
# parsing behavior. It's used in the documentation for
49724972
# `WP_HTML_Tag_Processor::escape_javascript_script_contents()`.
49734973
# ====
49744974
digraph {
49754975
rankdir=TB;
49764976
4977-
// Entry point
4978-
entry [shape=plaintext label="Open script"];
4979-
entry -> script_data;
4977+
// Entry point
4978+
entry [shape=plaintext label="Open script"];
4979+
entry -> script_data;
49804980
49814981
// Double-circle states arranged more compactly
49824982
data [shape=doublecircle label="Close script"];
@@ -4999,6 +4999,6 @@ public function get_doctype_info(): ?WP_HTML_Doctype_Info {
49994999
script_data_double_escaped -> script_data_escaped [label="</script†"];
50005000
50015001
label="† = Case insensitive 'script' followed by one of ' \\t\\f\\c\\n/>'";
5002-
labelloc=b;
5002+
labelloc=b;
50035003
}
50045004
*/

0 commit comments

Comments
 (0)