-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FormData.constructor fails when passed HTMLFormElement in Firefox #587
Comments
We are messing with HTMLFormElement. A temporary work around is to use ShadowDOMPolyfill.unwrapIfNeeded |
Where does |
Which browser? I think it only gets added if needed so it will not be there for Chrome (or future versions of Firefox). If my assumption is correct you can do something like the following to make it always work. var unwrapIfNeeded = function(x) {
return x;
}
if (typeof ShadowDOMPolyfill !== 'undefined') {
unwrapIfNeeded = ShadowDOMPolyfill.unwrapIfNeeded;
} |
Ah, I didn't check in Firefox and temporarily forgot that Chrome is the only browser that doesn't need to be shimmed here. Yes, that does seem to work. I'm extending a form element in a custom element I'm developing, and the following condensed version seems to work (where var form = window.ShadowDOMPolyfill ? ShadowDOMPolyfill.unwrapIfNeeded(this) : this;
var formData = new FormData(form); Thanks for your help on this. |
When using Polymer, you can always use
|
That makes it much simpler, thanks. Will the recently committed fix be part of 0.3.4? |
I ran a very simple test in Firefox 30 OSX: I attempted to pass an
HTMLFormElement
into aFormData
constructor. In the absence of platform.js, the attempt succeeds. As soon as I import platform.js, it fails.Please see this fiddle for a one-line demo of the issue. When run in Firefox as is, with the console open, you'll see the error. If you remove the platform.js import, it executes without error.
Is Polymer either messing with the
FormData
constructor, or perhapsHTMLFormElement
?The text was updated successfully, but these errors were encountered: