jondavidjohn / payform

:credit_card: A library for building credit card forms, validating inputs, and formatting numbers.
https://jondavidjohn.github.io/payform/
Other
427 stars 81 forks source link

Fix issue #17 - IE11 page hangs on empty input triggering #32

Closed joe-campiondigital-mo closed 6 years ago

joe-campiondigital-mo commented 6 years ago

This fixes https://github.com/jondavidjohn/payform/issues/17

IE11 set focus to an empty field if focus was lost. When focus was moved to another empty field this would cause a loop and melt the browser. There are no negatives fixing it like this as far as I can see as we don't want to format "" values anyway.

joe-campiondigital-mo commented 6 years ago

Hmm.. this doesn't fix the minified jQuery build. It works for the un-minified version.

I might have to re-visit this.

joe-campiondigital-mo commented 6 years ago

I had to tweak the build script to use uglifyjs rather than uglify as it was changing this logic. === was being converted to !== on minification. Very strange!

hppycoder commented 6 years ago

This feels like a really important change to have added, could we get this PR merged? We still have users on IE11 sadly.

jondavidjohn commented 6 years ago

@hppycoder Have you verified this does in fact fix the issue for IE11?

hppycoder commented 6 years ago

I will verify Tuesday. We are looking at changing our code out and our qa will be happy to look.

hppycoder commented 6 years ago

I am sorry it's taken me so long to test this. I am confirm that this code change will 100% fix the IE11 issue. I tested this by having a virtualbox with IE11 and Windows10 on it. I ensured that the current working example of: https://jondavidjohn.github.io/payform/ failed.

Not only did it lock the browser up but it did it with style! It moved the cursor between fields over and over and finally crashed the browser.

I then brought the example into a plnkr. I used the origional "payform.min.js" from the site and tested my plnkr. Found that it had the same affect as the current site to verify my plnkr was setup correctly. Then took the modified "payform.min.js" from the PR and tried again. It's working smoothly and does not crash the browser.

@jondavidjohn - Please merge this and create a release, I would like to bring into my current project as soon as possible.

jondavidjohn commented 6 years ago

Thanks for testing @hppycoder !