2017-08-14 05:01:11 +02:00
|
|
|
var $iterators = require('./es6.array.iterator');
|
|
|
|
var getKeys = require('./_object-keys');
|
|
|
|
var redefine = require('./_redefine');
|
|
|
|
var global = require('./_global');
|
|
|
|
var hide = require('./_hide');
|
|
|
|
var Iterators = require('./_iterators');
|
|
|
|
var wks = require('./_wks');
|
|
|
|
var ITERATOR = wks('iterator');
|
|
|
|
var TO_STRING_TAG = wks('toStringTag');
|
|
|
|
var ArrayValues = Iterators.Array;
|
2017-05-27 17:36:13 +02:00
|
|
|
|
2017-08-14 05:01:11 +02:00
|
|
|
var DOMIterables = {
|
|
|
|
CSSRuleList: true, // TODO: Not spec compliant, should be false.
|
|
|
|
CSSStyleDeclaration: false,
|
|
|
|
CSSValueList: false,
|
|
|
|
ClientRectList: false,
|
|
|
|
DOMRectList: false,
|
|
|
|
DOMStringList: false,
|
|
|
|
DOMTokenList: true,
|
|
|
|
DataTransferItemList: false,
|
|
|
|
FileList: false,
|
|
|
|
HTMLAllCollection: false,
|
|
|
|
HTMLCollection: false,
|
|
|
|
HTMLFormElement: false,
|
|
|
|
HTMLSelectElement: false,
|
|
|
|
MediaList: true, // TODO: Not spec compliant, should be false.
|
|
|
|
MimeTypeArray: false,
|
|
|
|
NamedNodeMap: false,
|
|
|
|
NodeList: true,
|
|
|
|
PaintRequestList: false,
|
|
|
|
Plugin: false,
|
|
|
|
PluginArray: false,
|
|
|
|
SVGLengthList: false,
|
|
|
|
SVGNumberList: false,
|
|
|
|
SVGPathSegList: false,
|
|
|
|
SVGPointList: false,
|
|
|
|
SVGStringList: false,
|
|
|
|
SVGTransformList: false,
|
|
|
|
SourceBufferList: false,
|
|
|
|
StyleSheetList: true, // TODO: Not spec compliant, should be false.
|
|
|
|
TextTrackCueList: false,
|
|
|
|
TextTrackList: false,
|
|
|
|
TouchList: false
|
|
|
|
};
|
|
|
|
|
|
|
|
for (var collections = getKeys(DOMIterables), i = 0; i < collections.length; i++) {
|
|
|
|
var NAME = collections[i];
|
|
|
|
var explicit = DOMIterables[NAME];
|
|
|
|
var Collection = global[NAME];
|
|
|
|
var proto = Collection && Collection.prototype;
|
|
|
|
var key;
|
|
|
|
if (proto) {
|
|
|
|
if (!proto[ITERATOR]) hide(proto, ITERATOR, ArrayValues);
|
|
|
|
if (!proto[TO_STRING_TAG]) hide(proto, TO_STRING_TAG, NAME);
|
2017-05-27 17:36:13 +02:00
|
|
|
Iterators[NAME] = ArrayValues;
|
2017-08-14 05:01:11 +02:00
|
|
|
if (explicit) for (key in $iterators) if (!proto[key]) redefine(proto, key, $iterators[key], true);
|
2017-05-27 17:36:13 +02:00
|
|
|
}
|
2017-08-14 05:01:11 +02:00
|
|
|
}
|