web.dom-collections.for-each.js 887 B

12345678910111213141516171819202122
  1. var global = require('../internals/global');
  2. var DOMIterables = require('../internals/dom-iterables');
  3. var DOMTokenListPrototype = require('../internals/dom-token-list-prototype');
  4. var forEach = require('../internals/array-for-each');
  5. var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
  6. var handlePrototype = function (CollectionPrototype) {
  7. // some Chrome versions have non-configurable methods on DOMTokenList
  8. if (CollectionPrototype && CollectionPrototype.forEach !== forEach) try {
  9. createNonEnumerableProperty(CollectionPrototype, 'forEach', forEach);
  10. } catch (error) {
  11. CollectionPrototype.forEach = forEach;
  12. }
  13. };
  14. for (var COLLECTION_NAME in DOMIterables) {
  15. if (DOMIterables[COLLECTION_NAME]) {
  16. handlePrototype(global[COLLECTION_NAME] && global[COLLECTION_NAME].prototype);
  17. }
  18. }
  19. handlePrototype(DOMTokenListPrototype);