-1

I have a little problem, because I wrote my plugin using Object.create and it's working only on IE9+.

My plugin definition:

$.fn.MYPL = function (options) {
    return this.each(function () {
        myplg = Object.create(MYPL);
        myplg.init(options, this);
    });
};

But before every JS code I have the following:

if (typeof Object.create !== "function") {
    Object.create = (function () {
        function F() {} // created only once
        return function (o) {
            F.prototype = o; // reused on each invocation
            return new F();
        };
    })();
}

It works fine on IE9+ but IE6 and IE7 (even IE8) seems to be not supporting Object.create or what? Am I missing sth?

Rafff
  • 1,510
  • 3
  • 19
  • 38
  • possible duplicate of [From which version, IE can support Object.create(null)?](http://stackoverflow.com/questions/7023255/from-which-version-ie-can-support-object-createnull) – cmbuckley Oct 05 '13 at 11:12
  • It's not a duplicate. I'm looking for something equivalent to the Object.create since it's not supported in IE6+. – Rafff Oct 05 '13 at 11:16
  • 1
    The `Object.create` patch in your question works just fine in IE6/7. – user2736012 Oct 05 '13 at 14:42

2 Answers2

0

Check Wikipedia's JavaScript version history. If you find 1.8.5 version - and this is the language version where you find this Object factory method available - 9th version of Internet Explorer is the one supporting that.

The ECMAScript 5 Compatibility Table also has this information.

You can also try for yourself using one of Microsoft's IE virtual machines (available from here or, for very old versions of IE, Multiple IE.

Sourced from From which version, IE can support Object.create(null)?

Community
  • 1
  • 1
Praveen Kumar Purushothaman
  • 164,888
  • 24
  • 203
  • 252
0

Older IE versions will not support Object.create. Read here https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create

Try to create object using constructor which is described here https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Inheritance_and_the_prototype_chain

Anshad Vattapoyil
  • 23,145
  • 18
  • 84
  • 132