_object-gopn-ext.js 604 B

12345678910111213141516171819
  1. // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
  2. var toIObject = require('./_to-iobject');
  3. var gOPN = require('./_object-gopn').f;
  4. var toString = {}.toString;
  5. var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
  6. ? Object.getOwnPropertyNames(window) : [];
  7. var getWindowNames = function (it) {
  8. try {
  9. return gOPN(it);
  10. } catch (e) {
  11. return windowNames.slice();
  12. }
  13. };
  14. module.exports.f = function getOwnPropertyNames(it) {
  15. return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(toIObject(it));
  16. };