WordPress.org

Make WordPress Core

Changeset 20299


Ignore:
Timestamp:
03/28/2012 09:10:29 AM (7 years ago)
Author:
koopersmith
Message:

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.

Location:
trunk/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/class-wp-customize-control.php

    r20295 r20299  
    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
  • trunk/wp-includes/js/customize-controls.dev.js

    r20297 r20299  
    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 ) {
Note: See TracChangeset for help on using the changeset viewer.