jimmywarting / FormData

HTML5 `FormData` polyfill for Browsers and nodejs
MIT License
360 stars 102 forks source link

Methods not getting added in Edge #103

Closed freon27 closed 4 years ago

freon27 commented 4 years ago

Hi, we're using the polyfill in our Angular app (thanks!) and it's working great for IE11 and iOS. The company I'm working at are currently stuck on the following Edge version:

Microsoft Edge 41.16299.1419.0 Microsoft EdgeHTML 16.16299

We're creating an empty FormData object with new both with and without a form element as parameter. When we try to use .has we get an error that it's not a function. Investigating the prototype, we see that the object only has append and constructor which matches what was natively implemented in this version so it seems like the polyfill isn't being applied at all. We tried updating the polyfill to the latest version but it's not made any difference.

I've looked though the previous issues related to Edge but couldn't see this issue. Any ideas?

jimmywarting commented 4 years ago

maybe something wrong with this condition? https://github.com/jimmywarting/FormData/blob/e52a90ceb2e3424e5e2203760ecaeef21dbc5186/FormData.js#L4

freon27 commented 4 years ago

Thanks for the quick reply :)

Digging deeper it seems like maybe there's something wrong with the minified version from NPM. If we take FormData.js and minify it ourselves, everything works. Is that possible?

The problem is essentially that at the point that it tries to access .Symbol the object is undefined.

jimmywarting commented 4 years ago

if it fails at the point of .Symbol then i might suspect that it might have a problem accessing the global object

  var m = "function" == typeof Object.defineProperties ? Object.defineProperty : function(a, b, c) {
      a != Array.prototype && a != Object.prototype && (a[b] = c.value)
    },
    // failing?????
    n = "undefined" != typeof window && window === this ? this : "undefined" != typeof global && null != global ? global : this;

  function p() {
    p = function() {};
    n.Symbol || (n.Symbol = r)
  }
freon27 commented 4 years ago

My colleague who actually has access to Edge is currently out of the office so I'll get him to check when he's back.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.