Skip to content

Commit c370fca

Browse files
committed
added escaping to the for id attribute for scripts and styles
1 parent a49176e commit c370fca

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/wp-includes/class-wp-scripts.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ public function do_item( $handle, $group = false ) {
341341

342342
$translations = $this->print_translations( $handle, false );
343343
if ( $translations ) {
344-
$translations = wp_get_inline_script_tag( $translations, array( 'id' => "{$handle}-js-translations" ) );
344+
$translations = wp_get_inline_script_tag( $translations, array( 'id' => esc_attr( $handle ) . '-js-translations' ) );
345345
}
346346

347347
if ( $this->do_concat ) {
@@ -417,7 +417,7 @@ public function do_item( $handle, $group = false ) {
417417

418418
$attr = array(
419419
'src' => $src,
420-
'id' => "{$handle}-js",
420+
'id' => esc_attr( $handle ) . '-js',
421421
);
422422
if ( $strategy ) {
423423
$attr[ $strategy ] = true;

src/wp-includes/class-wp-styles.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ public function do_item( $handle, $group = false ) {
229229
$tag = sprintf(
230230
"<link rel='%s' id='%s-css'%s href='%s'%s media='%s' />\n",
231231
$rel,
232-
$handle,
232+
esc_attr( $handle ),
233233
$title,
234234
$href,
235235
$this->type_attr,
@@ -261,7 +261,7 @@ public function do_item( $handle, $group = false ) {
261261
$rtl_tag = sprintf(
262262
"<link rel='%s' id='%s-rtl-css'%s href='%s'%s media='%s' />\n",
263263
$rel,
264-
$handle,
264+
esc_attr( $handle ),
265265
$title,
266266
$rtl_href,
267267
$this->type_attr,

0 commit comments

Comments
 (0)