Sha256: 47ecfd150d1f62cf13f90052f8e3209b04c74902bc4b4e0ea921344fef51b36a

Contents?: true

Size: 1.74 KB

Versions: 12

Compression:

Stored size: 1.74 KB

Contents

var anObject = require('../internals/an-object');
var defineProperties = require('../internals/object-define-properties');
var enumBugKeys = require('../internals/enum-bug-keys');
var hiddenKeys = require('../internals/hidden-keys');
var html = require('../internals/html');
var documentCreateElement = require('../internals/document-create-element');
var sharedKey = require('../internals/shared-key');
var IE_PROTO = sharedKey('IE_PROTO');

var PROTOTYPE = 'prototype';
var Empty = function () { /* empty */ };

// Create object with fake `null` prototype: use iframe Object with cleared prototype
var createDict = function () {
  // Thrash, waste and sodomy: IE GC bug
  var iframe = documentCreateElement('iframe');
  var length = enumBugKeys.length;
  var lt = '<';
  var script = 'script';
  var gt = '>';
  var js = 'java' + script + ':';
  var iframeDocument;
  iframe.style.display = 'none';
  html.appendChild(iframe);
  iframe.src = String(js);
  iframeDocument = iframe.contentWindow.document;
  iframeDocument.open();
  iframeDocument.write(lt + script + gt + 'document.F=Object' + lt + '/' + script + gt);
  iframeDocument.close();
  createDict = iframeDocument.F;
  while (length--) delete createDict[PROTOTYPE][enumBugKeys[length]];
  return createDict();
};

// `Object.create` method
// https://tc39.github.io/ecma262/#sec-object.create
module.exports = Object.create || function create(O, Properties) {
  var result;
  if (O !== null) {
    Empty[PROTOTYPE] = anObject(O);
    result = new Empty();
    Empty[PROTOTYPE] = null;
    // add "__proto__" for Object.getPrototypeOf polyfill
    result[IE_PROTO] = O;
  } else result = createDict();
  return Properties === undefined ? result : defineProperties(result, Properties);
};

hiddenKeys[IE_PROTO] = true;

Version data entries

12 entries across 12 versions & 4 rubygems

Version Path
disco_app-0.18.0 test/dummy/node_modules/core-js/internals/object-create.js
disco_app-0.18.2 test/dummy/node_modules/core-js/internals/object-create.js
condenser-0.0.8 lib/condenser/processors/node_modules/core-js-pure/internals/object-create.js
jester-data-8.0.0 node_modules/core-js/internals/object-create.js
ezii-os-5.2.1 node_modules/core-js/internals/object-create.js
ezii-os-2.0.1 node_modules/core-js/internals/object-create.js
ezii-os-1.1.0 node_modules/core-js/internals/object-create.js
ezii-os-1.0.0 node_modules/core-js/internals/object-create.js
condenser-0.0.7 lib/condenser/processors/node_modules/core-js-pure/internals/object-create.js
ezii-os-0.0.0.1.0 node_modules/core-js/internals/object-create.js
ezii-os-0.0.0.0.1 node_modules/core-js/internals/object-create.js
condenser-0.0.5 lib/condenser/processors/node_modules/core-js-pure/internals/object-create.js