fregante/image-promise

Strings also have length

Closed this issue · 4 comments

homm commented

loadImage( '/cat.jpg' ); leads ot Maximum call stack size exceeded because of '/cat.jpg' is a string with length 8 which is treated as array, where the first element is a string '/' with length 1 which is treated as array, where the first element is a string '/' with length 1 which is treated as array, where the first element is a string '/' with length 1 which is treated as array, where the first element is a string '/' with length 1 which is treated as array, where the first element is a string '/' with length 1 which is treated as array, where the first element is a string '/' with length 1 which is treated as array, where the first element is a string '/' with length 1 which is treated as array, where the first element is a string '/' with length 1 which is treated as array, where the first element is a string '/' with length 1 which is treated as array, where the first element is a string '/' with length 1 which is treated as array, where the first element is a string '/' with length 1 which is treated as array, where the first element is a string '/' with length 1 which is treated as array, where the first element is a string '/' with length 1 which is treated as array, where the first element is a string '/' with length 1

Fuuuuuuuuuuuuuuu I played around a lot with that detection and of course I screwed up.

Let me know if 4.0.1 fixes it for you

homm commented

I fixed it on my side with $.isArray() because I already used jQuery.

It's not equivalent though; $.isArray() only works with literal arrays, it doesn't detect document.querySelectorAll('img) nor $('img') itself.

image-promise should handle all those situations now