From ea85772eb6c4e2d0a3c658cb4895456104ef8dec Mon Sep 17 00:00:00 2001 From: Daryl Koopersmith Date: Wed, 28 Mar 2012 09:10:29 +0000 Subject: [PATCH] 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 --- wp-includes/class-wp-customize-control.php | 2 +- wp-includes/js/customize-controls.dev.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/wp-includes/class-wp-customize-control.php b/wp-includes/class-wp-customize-control.php index 10ce6ce3dd..32d76658df 100644 --- a/wp-includes/class-wp-customize-control.php +++ b/wp-includes/class-wp-customize-control.php @@ -145,7 +145,7 @@ class WP_Customize_Control { * @since 3.4.0 */ protected function render() { - $id = 'customize-control-' . $this->id; + $id = 'customize-control-' . str_replace( '[', '-', str_replace( ']', '', $this->id ) ); $class = 'customize-control customize-control-' . $this->type; $style = ''; diff --git a/wp-includes/js/customize-controls.dev.js b/wp-includes/js/customize-controls.dev.js index 996c727337..d16b91514a 100644 --- a/wp-includes/js/customize-controls.dev.js +++ b/wp-includes/js/customize-controls.dev.js @@ -48,7 +48,8 @@ $.extend( this, options || {} ); this.id = id; - this.container = $( '#customize-control-' + id ); + this.selector = '#customize-control-' + id.replace( ']', '' ).replace( '[', '-' ); + this.container = $( this.selector ); settings = $.map( this.params.settings, function( value ) { return value;