prototypejs / prototype

Prototype JavaScript framework
http://prototypejs.org/
Other
3.53k stars 639 forks source link

Array.from doesn't work with some iterables #359

Open ecolui opened 1 year ago

ecolui commented 1 year ago

Consider the following code.

const l_array = ['a', 'b', 'c'];
const l_it = l_array[Symbol.iterator]();            //convert to iterator
var result = Array.from(l_it);

When that code is called from JavaScript's native Array.from, the result is ['a', 'b', 'c']

When that function is called from prototype.js Array.from, the result is [] https://github.com/prototypejs/prototype/blob/master/src/prototype/lang/array.js

timkingman commented 8 months ago

This also breaks Google Maps (new today or very recently?). Removing the Array.from = $A line fixes Google Maps, but I'm not sure if I've broken any of my other ancient Prototype code.