Skip to content

Commit ea85772

Browse files
author
Daryl Koopersmith
committed
Theme Customizer: Sanitize selectors by transforming square brackets into dashes. see #19910.
This both better conforms to the CSS spec and prevents bugs from occurring in JavaScript selector engines. git-svn-id: https://develop.svn.wordpress.org/trunk@20299 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 4e658d4 commit ea85772

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

wp-includes/class-wp-customize-control.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ public final function maybe_render() {
145145
* @since 3.4.0
146146
*/
147147
protected function render() {
148-
$id = 'customize-control-' . $this->id;
148+
$id = 'customize-control-' . str_replace( '[', '-', str_replace( ']', '', $this->id ) );
149149
$class = 'customize-control customize-control-' . $this->type;
150150

151151
$style = '';

wp-includes/js/customize-controls.dev.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@
4848
$.extend( this, options || {} );
4949

5050
this.id = id;
51-
this.container = $( '#customize-control-' + id );
51+
this.selector = '#customize-control-' + id.replace( ']', '' ).replace( '[', '-' );
52+
this.container = $( this.selector );
5253

5354
settings = $.map( this.params.settings, function( value ) {
5455
return value;

0 commit comments

Comments
 (0)