UNPKG

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