Evan
Evan

Reputation: 6115

IE9 Object.defineProperty not working

I have a Model class and I would like to use the following to set a getter on it, but it seems to fail in IE9 but works fine in modern browsers. Any ideas why?

    Object.defineProperty(Model, 'propType', {
        get: function () {
            var propType = React.PropTypes.shape(config.fields);
            propType.Class = this;

            return propType;
        }
    });

Upvotes: 1

Views: 590

Answers (1)

DynamicDispatch
DynamicDispatch

Reputation: 421

Is it possible that React.PropTypes.shape(config.fields); is returning undefined in IE9? If that's the case, the statement propType.Class = this; would throw a ReferenceError, which would explain why setting an alert or debugger statement in get doesn't work.

If ReactJS is the problem, it might just be that you need some polyfills. React may need some ES5 polyfills to work in IE9. For more info, see:

Hope that helps.

Upvotes: 1

Related Questions