ftlabs/fastclick — pull request #201 by lpender (2014-01-07 00:53:56+00:00)
Title: iOs 'beforeunload' shim

I like to have a 'loading' state, with an animated icon appear on 'beforeunload'. Having a loading icon popup immediately reinforces the feeling that your browser is "responding" to your input rapidly which, after, all is the point of this plugin.

However iOs doesn't support 'beforeunload' events, although
```
"onbeforeunload' in window
```
returns true.

I thought it would be good to bundle a 'beforeUnload' shim with this plugin. It's especially convenient because you can be sure that it will only check if the event was cancelled, after any JS has had the opportunity to 'preventDefault' on the click event (i.e. at the end of the sendClick method).

It could be extended to other devices which don't support 'beforeunload' events by adding them to the supportsBeforeUnload method.

I've added a test page as well, though I wasn't sure what to number it (I chose 170?).

It looks like a lot of code, but a lot of it is also comments.

Compressed size before: 8113
Compressed size after: 9239
Diff : 1126

Thanks!
-L