mui / material-ui

Material UI: Comprehensive React component library that implements Google's Material Design. Free forever.
https://mui.com/material-ui/
MIT License
93.51k stars 32.19k forks source link

[createGenerateClassName] Request to add forward slash to "escapeRegex" #13024

Closed huisenwu closed 6 years ago

huisenwu commented 6 years ago

The following code block does not work in IE11 because IE11 failed to parse class name with forward slash.

const styles = {
    root: {
        backgroundColor: "red"
    }
};

@withStyles(styles, {name: "foo/bar"})
class MyComponent extends React.Component {
    render () {
        return <div className={this.props.classes.root}>Hello World!</div>;
    }
}

export default MyComponent;

Under non-production environment, withStyles adds name option or React component's displayName as the prefix to class names. If the name option or React component's displayName contains forward slash, the classes do not work in IE11.

So request to add forward slash to regular expression escapeRegex in createGenerateClassName.

oliviertassinari commented 6 years ago

I'm closing for https://github.com/cssinjs/jss/issues/870