BladeRunnerJS / topiarist

Topiarist provides tree and shape-based type verification for JavaScript.
MIT License
22 stars 4 forks source link

Topiarist does not work in IE8 without es5-shim #10

Closed fauna5 closed 10 years ago

fauna5 commented 10 years ago

This method gets around the fact that Object.create might not exists. However it uses Object.keys which might not exist. We get around this by using es5-shim, but i think topiarist is intended to be used on it's own in IE8 as it tries to shim.

var create = Object.create ? Object.create : function(proto, descriptors) {
    var myConstructor = function() {};
    myConstructor.prototype = proto;

    var result = new myConstructor();

    var keys = Object.keys(descriptors);
    for (var i = 0; i < keys.length; ++i) {
        var key = keys[i];
        defineProperty(result, key, descriptors[key]);
    }

    return result;
};
andy-berry-dev commented 10 years ago

We've taken the approach of requiring users of our micro libraries to provide the relevant shims to make them work on IE8. We make sure the libraries work on IE8 by providing the shims when running tests and BRJS also provides the shims via the ie8-shims library. I've moved the Object.create shim out of Topiarist so this fix is no longer needed.