File tree Expand file tree Collapse file tree 1 file changed +3
-6
lines changed
Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -3752,10 +3752,7 @@ public function set_modifiable_text( string $plaintext_content ): bool {
37523752 *
37533753 * @see https://html.spec.whatwg.org/multipage/parsing.html#script-data-double-escaped-state
37543754 */
3755- if (
3756- false !== stripos ( $ plaintext_content , '</script ' ) ||
3757- false !== stripos ( $ plaintext_content , '<script ' )
3758- ) {
3755+ if ( preg_match ( '~</?script[\t\n\f />]~i ' , $ plaintext_content ) ) {
37593756 /*
37603757 * JavaScript can be safely escaped.
37613758 * Non-JavaScript script tags have unknown semantics.
@@ -3764,12 +3761,12 @@ public function set_modifiable_text( string $plaintext_content ): bool {
37643761 */
37653762 if ( $ this ->is_javascript_script_tag () ) {
37663763 $ plaintext_content = preg_replace_callback (
3767- '~<(/?)(s)(cript)~i ' ,
3764+ '~<(/?)(s)(cript)([\t\n\f />]) ~i ' ,
37683765 static function ( $ matches ) {
37693766 $ escaped_s_char = 's ' === $ matches [2 ]
37703767 ? '\u0073 '
37713768 : '\u0053 ' ;
3772- return "< {$ matches [1 ]}{$ escaped_s_char }{$ matches [3 ]}" ;
3769+ return "< {$ matches [1 ]}{$ escaped_s_char }{$ matches [3 ]}{ $ matches [ 4 ]} " ;
37733770 },
37743771 $ plaintext_content
37753772 );
You can’t perform that action at this time.
0 commit comments