Protect the submit function from a thrown exception.

If an exception is thrown the edit is cancelled.
Also implemented a cancel when the function just
returns undefined.

Remove test for strict mode. This is just a test
of the browser implementing it properly and on
Android 4 it doesn't work how I expect. Thats nothing
to do with our code though.