web.dom.iterable.js 969 B

12345678910111213141516171819
  1. require('./es6.array.iterator');
  2. var global = require('./_global');
  3. var hide = require('./_hide');
  4. var Iterators = require('./_iterators');
  5. var TO_STRING_TAG = require('./_wks')('toStringTag');
  6. var DOMIterables = ('CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,' +
  7. 'DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,' +
  8. 'MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,' +
  9. 'SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,' +
  10. 'TextTrackList,TouchList').split(',');
  11. for (var i = 0; i < DOMIterables.length; i++) {
  12. var NAME = DOMIterables[i];
  13. var Collection = global[NAME];
  14. var proto = Collection && Collection.prototype;
  15. if (proto && !proto[TO_STRING_TAG]) hide(proto, TO_STRING_TAG, NAME);
  16. Iterators[NAME] = Iterators.Array;
  17. }