We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 863eb3c commit d1355bfCopy full SHA for d1355bf
1 file changed
modules/angular2/src/facade/collection.ts
@@ -234,6 +234,16 @@ export function iterateListLike(obj, fn: Function) {
234
}
235
236
export class SetWrapper {
237
- static createFromList<T>(lst: List<T>): Set<T> { return new Set(lst); }
+ // Safari and Internet Explorer do not support the iterable parameter to the
238
+ // Set constructor. We work around that by manually adding the items.
239
+ static createFromList<T>(lst: List<T>): Set<T> {
240
+ var res = new Set(lst);
241
+ if (res.size !== lst.length) {
242
+ for (var i = 0; i < lst.length; i++) {
243
+ res.add(lst[i]);
244
+ }
245
246
+ return res;
247
248
static has<T>(s: Set<T>, key: T): boolean { return s.has(key); }
249
0 commit comments