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: http://svn.automattic.com/wordpress/trunk@20299 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
koopersmith 2012-03-28 09:10:29 +00:00
parent e6acfbf233
commit b41d074b1b
2 changed files with 3 additions and 2 deletions

View File

@ -145,7 +145,7 @@ class WP_Customize_Control {
* @since 3.4.0 * @since 3.4.0
*/ */
protected function render() { protected function render() {
$id = 'customize-control-' . $this->id; $id = 'customize-control-' . str_replace( '[', '-', str_replace( ']', '', $this->id ) );
$class = 'customize-control customize-control-' . $this->type; $class = 'customize-control customize-control-' . $this->type;
$style = ''; $style = '';

View File

@ -48,7 +48,8 @@
$.extend( this, options || {} ); $.extend( this, options || {} );
this.id = id; 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 ) { settings = $.map( this.params.settings, function( value ) {
return value; return value;