reqwest icon indicating copy to clipboard operation
reqwest copied to clipboard

fix checking for FormData existence

Open yeonhoyoon opened this issue 11 years ago • 4 comments

in Safari, typeof FormData returns "object" instead of "function"

yeonhoyoon avatar Jul 16 '14 01:07 yeonhoyoon

In that case, is there a more legit way of checking like seeing if it has any unique properties?

ded avatar Jul 16 '14 04:07 ded

Isn't o['data'] instanceof FormData enough on its own? Why is the typeof check neccesary?

keronsen avatar Oct 31 '14 10:10 keronsen

@keronsen In older browsers, FormData is not defined, so o['data'] instanceof FormData will throw ReferenceError.

yeonhoyoon avatar Oct 31 '14 17:10 yeonhoyoon

Any updates on this? According to @yeonhoyoon's last comment, perhaps the check should be:

typeof FormData !== 'undefined', or 'FormData' in window

thomsbg avatar Aug 31 '15 23:08 thomsbg