Skip to content

Style updates silently fail with trailing semicolon in style #2862

@brigand

Description

@brigand

On the first render it works, but then the update silently fails. Expected would be the semicolon being removed, or an error/warning in the development build.

Tested on Chrome latest, Firefox latest, with 0.12.1 and master.

Minimal: jsbin

var App = React.createClass({
  getInitialState: function(){
    return {color: 'red'}
  },

  handleClick : function() {
    console.log('hello world');
    this.setState({
      color: 'blue'
    });
  },

  render: function() {
    console.log('rendering');
    var style = {
      backgroundColor: this.state.color
    };

    if (this.props.withsemi) {
      style.backgroundColor += ";";
    }

    return (
    <div>
      <div style={style} onClick={this.handleClick}></div>
    </div>
    )
  }
});

@rabishah ran into (on IRC).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions