libreform / wp-libre-form

Easy native HTML5 forms for WordPress. Version 1.5 is unmaintained, but works without issue. 2.0 has been rewritten from the ground, and can be found at https://github.com/libreform/libreform
https://wordpress.org/plugins/wp-libre-form
GNU General Public License v3.0
67 stars 27 forks source link

Download polyfills only if necessary #76

Closed k1sul1 closed 7 years ago

anttiviljami commented 7 years ago

I'm getting this error when using this branch. The form doesn't submit properly either.

screen shot 2017-10-02 at 23 05 24
k1sul1 commented 7 years ago

Hmm, I noticed that I had the condition wrong 5 seconds after submitting the PR, so I added ! to it and force pushed so no one would notice.

Apparently [].map() returns undefined if you never return (which is what happened). Adding .filter(Boolean) to the chain should work.

anttiviljami commented 7 years ago

script is still not initialising the form. the script is included on the page but submit falls back to a GET request

anttiviljami commented 7 years ago

I'm not really following the logic of your dependency loader. It seems to only initalize if all dependencies are loaded via polyfills.

anttiviljami commented 7 years ago

Shouldn't you increment dependencies_loaded in the else block here? https://github.com/anttiviljami/wp-libre-form/pull/76/files#diff-8554cc24257276c75d5d599331aa60b2R126

k1sul1 commented 7 years ago

This PR is a mess :D I took most of the code that I wrote back in January for #48 and changed it a "bit". Back then dependencies was empty if you didn't need any dependencies, now it has two values and dependencies_loaded is obviously broken.

I'll clean this branch up and submit another.