2019-09-25 13:30:05 +05:30
|
|
|
var global = require('../internals/global');
|
|
|
|
var DOMIterables = require('../internals/dom-iterables');
|
|
|
|
var ArrayIteratorMethods = require('../modules/es.array.iterator');
|
2019-10-31 01:37:42 +05:30
|
|
|
var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
|
2019-09-25 13:30:05 +05:30
|
|
|
var wellKnownSymbol = require('../internals/well-known-symbol');
|
|
|
|
|
|
|
|
var ITERATOR = wellKnownSymbol('iterator');
|
|
|
|
var TO_STRING_TAG = wellKnownSymbol('toStringTag');
|
|
|
|
var ArrayValues = ArrayIteratorMethods.values;
|
|
|
|
|
|
|
|
for (var COLLECTION_NAME in DOMIterables) {
|
|
|
|
var Collection = global[COLLECTION_NAME];
|
|
|
|
var CollectionPrototype = Collection && Collection.prototype;
|
|
|
|
if (CollectionPrototype) {
|
|
|
|
// some Chrome versions have non-configurable methods on DOMTokenList
|
|
|
|
if (CollectionPrototype[ITERATOR] !== ArrayValues) try {
|
2019-10-31 01:37:42 +05:30
|
|
|
createNonEnumerableProperty(CollectionPrototype, ITERATOR, ArrayValues);
|
2019-09-25 13:30:05 +05:30
|
|
|
} catch (error) {
|
|
|
|
CollectionPrototype[ITERATOR] = ArrayValues;
|
|
|
|
}
|
2019-10-31 01:37:42 +05:30
|
|
|
if (!CollectionPrototype[TO_STRING_TAG]) {
|
|
|
|
createNonEnumerableProperty(CollectionPrototype, TO_STRING_TAG, COLLECTION_NAME);
|
|
|
|
}
|
2019-09-25 13:30:05 +05:30
|
|
|
if (DOMIterables[COLLECTION_NAME]) for (var METHOD_NAME in ArrayIteratorMethods) {
|
|
|
|
// some Chrome versions have non-configurable methods on DOMTokenList
|
|
|
|
if (CollectionPrototype[METHOD_NAME] !== ArrayIteratorMethods[METHOD_NAME]) try {
|
2019-10-31 01:37:42 +05:30
|
|
|
createNonEnumerableProperty(CollectionPrototype, METHOD_NAME, ArrayIteratorMethods[METHOD_NAME]);
|
2019-09-25 13:30:05 +05:30
|
|
|
} catch (error) {
|
|
|
|
CollectionPrototype[METHOD_NAME] = ArrayIteratorMethods[METHOD_NAME];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|